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

Method removePeerLocked

tailnet/coordinator.go:476–493  ·  view source on GitHub ↗
(id uuid.UUID, kind proto.CoordinateResponse_PeerUpdate_Kind, reason, closeErr string)

Source from the content-addressed store, hash-verified

474}
475
476func (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.

Callers 6

handleRequestMethod · 0.95
addTunnelLockedMethod · 0.95
removeTunnelLockedMethod · 0.95
lostPeerMethod · 0.95
closeMethod · 0.95

Calls 2

removeAllMethod · 0.80

Tested by

no test coverage detected