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

Struct MultiAgentController

coderd/tailnet.go:379–396  ·  view source on GitHub ↗

MultiAgentController is a tailnet.CoordinationController for connecting to multiple workspace agents. It keeps track of connection times to the agents, and removes them on a timer if they have no active connections and haven't been used in a while.

Source from the content-addressed store, hash-verified

377// agents. It keeps track of connection times to the agents, and removes them on a timer if they
378// have no active connections and haven't been used in a while.
379type MultiAgentController struct {
380 *tailnet.BasicCoordinationController
381
382 logger slog.Logger
383 tracer trace.Tracer
384
385 mu sync.Mutex
386 // connectionTimes is a map of agents the server wants to keep a connection to. It
387 // contains the last time the agent was connected to.
388 connectionTimes map[uuid.UUID]time.Time
389 // tickets is a map of destinations to a set of connection tickets, representing open
390 // connections to the destination
391 tickets map[uuid.UUID]map[uuid.UUID]struct{}
392 coordination *tailnet.BasicCoordination
393
394 cancel context.CancelFunc
395 expireOldAgentsDone chan struct{}
396}
397
398func (m *MultiAgentController) New(client tailnet.CoordinatorClient) tailnet.CloserWaiter {
399 b := m.BasicCoordinationController.NewCoordination(client)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected