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

Method New

tailnet/controllers.go:420–445  ·  view source on GitHub ↗
(client CoordinatorClient)

Source from the content-addressed store, hash-verified

418}
419
420func (c *TunnelSrcCoordController) New(client CoordinatorClient) CloserWaiter {
421 c.mu.Lock()
422 defer c.mu.Unlock()
423 b := c.BasicCoordinationController.NewCoordination(client)
424 c.coordination = b
425 // resync destinations on reconnect
426 for dest := range c.dests {
427 err := b.SendRequest(&proto.CoordinateRequest{
428 AddTunnel: &proto.CoordinateRequest_Tunnel{Id: UUIDToByteSlice(dest)},
429 })
430 if err != nil {
431 b.SendErr(err)
432 c.coordination = nil
433 cErr := client.Close()
434 if cErr != nil {
435 c.Logger.Debug(
436 context.Background(),
437 "failed to close coordinator client after add tunnel failure",
438 slog.Error(cErr),
439 )
440 }
441 break
442 }
443 }
444 return b
445}
446
447func (c *TunnelSrcCoordController) AddDestination(dest uuid.UUID) {
448 c.mu.Lock()

Calls 8

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