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

Method New

coderd/tailnet.go:398–418  ·  view source on GitHub ↗
(client tailnet.CoordinatorClient)

Source from the content-addressed store, hash-verified

396}
397
398func (m *MultiAgentController) New(client tailnet.CoordinatorClient) tailnet.CloserWaiter {
399 b := m.BasicCoordinationController.NewCoordination(client)
400 // resync all destinations
401 m.mu.Lock()
402 defer m.mu.Unlock()
403 m.coordination = b
404 for agentID := range m.connectionTimes {
405 err := b.SendRequest(&proto.CoordinateRequest{
406 AddTunnel: &proto.CoordinateRequest_Tunnel{Id: agentID[:]},
407 })
408 if err != nil {
409 m.logger.Error(context.Background(), "failed to re-add tunnel", slog.F("agent_id", agentID),
410 slog.Error(err))
411 b.SendErr(err)
412 _ = client.Close()
413 m.coordination = nil
414 break
415 }
416 }
417 return b
418}
419
420func (m *MultiAgentController) ensureAgent(agentID uuid.UUID) error {
421 m.mu.Lock()

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected