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.
| 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. |
| 379 | type 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 | |
| 398 | func (m *MultiAgentController) New(client tailnet.CoordinatorClient) tailnet.CloserWaiter { |
| 399 | b := m.BasicCoordinationController.NewCoordination(client) |
nothing calls this directly
no outgoing calls
no test coverage detected