(client tailnet.CoordinatorClient)
| 396 | } |
| 397 | |
| 398 | func (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 | |
| 420 | func (m *MultiAgentController) ensureAgent(agentID uuid.UUID) error { |
| 421 | m.mu.Lock() |
nothing calls this directly
no test coverage detected