(id uuid.UUID, kind proto.CoordinateResponse_PeerUpdate_Kind, reason, closeErr string)
| 474 | } |
| 475 | |
| 476 | func (c *core) removePeerLocked(id uuid.UUID, kind proto.CoordinateResponse_PeerUpdate_Kind, reason, closeErr string) { |
| 477 | p, ok := c.peers[id] |
| 478 | if !ok { |
| 479 | c.logger.Critical(context.Background(), "removed non-existent peer", slog.F("peer_id", id)) |
| 480 | return |
| 481 | } |
| 482 | c.updateTunnelPeersLocked(id, nil, kind, reason) |
| 483 | c.tunnels.removeAll(id) |
| 484 | if closeErr != "" { |
| 485 | select { |
| 486 | case p.resps <- &proto.CoordinateResponse{Error: closeErr}: |
| 487 | default: |
| 488 | // blocked, pass. |
| 489 | } |
| 490 | } |
| 491 | close(p.resps) |
| 492 | delete(c.peers, id) |
| 493 | } |
| 494 | |
| 495 | // Close closes all of the open connections in the coordinator and stops the |
| 496 | // coordinator from accepting new connections. |
no test coverage detected