| 469 | } |
| 470 | |
| 471 | func (c *TunnelSrcCoordController) RemoveDestination(dest uuid.UUID) { |
| 472 | c.mu.Lock() |
| 473 | defer c.mu.Unlock() |
| 474 | delete(c.dests, dest) |
| 475 | if c.coordination == nil { |
| 476 | return |
| 477 | } |
| 478 | err := c.coordination.SendRequest( |
| 479 | &proto.CoordinateRequest{ |
| 480 | RemoveTunnel: &proto.CoordinateRequest_Tunnel{Id: UUIDToByteSlice(dest)}, |
| 481 | }) |
| 482 | if err != nil { |
| 483 | c.coordination.SendErr(err) |
| 484 | cErr := c.coordination.client.Close() // close the client so we don't gracefully disconnect |
| 485 | if cErr != nil { |
| 486 | c.Logger.Debug(context.Background(), |
| 487 | "failed to close coordinator client after remove tunnel failure", |
| 488 | slog.Error(cErr)) |
| 489 | } |
| 490 | c.coordination = nil |
| 491 | } |
| 492 | } |
| 493 | |
| 494 | func (c *TunnelSrcCoordController) SyncDestinations(destinations []uuid.UUID) { |
| 495 | c.mu.Lock() |