MCPcopy Index your code
hub / github.com/coder/coder / AddDestination

Method AddDestination

tailnet/controllers.go:447–469  ·  view source on GitHub ↗
(dest uuid.UUID)

Source from the content-addressed store, hash-verified

445}
446
447func (c *TunnelSrcCoordController) AddDestination(dest uuid.UUID) {
448 c.mu.Lock()
449 defer c.mu.Unlock()
450 c.Coordinatee.SetTunnelDestination(dest) // this prepares us for an ack
451 c.dests[dest] = struct{}{}
452 if c.coordination == nil {
453 return
454 }
455 err := c.coordination.SendRequest(
456 &proto.CoordinateRequest{
457 AddTunnel: &proto.CoordinateRequest_Tunnel{Id: UUIDToByteSlice(dest)},
458 })
459 if err != nil {
460 c.coordination.SendErr(err)
461 cErr := c.coordination.client.Close() // close the client so we don't gracefully disconnect
462 if cErr != nil {
463 c.Logger.Debug(context.Background(),
464 "failed to close coordinator client after add tunnel failure",
465 slog.Error(cErr))
466 }
467 c.coordination = nil
468 }
469}
470
471func (c *TunnelSrcCoordController) RemoveDestination(dest uuid.UUID) {
472 c.mu.Lock()

Calls 8

UUIDToByteSliceFunction · 0.85
SendRequestMethod · 0.80
SendErrMethod · 0.80
SetTunnelDestinationMethod · 0.65
CloseMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
ErrorMethod · 0.45