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

Method lostPeer

tailnet/coordinator.go:462–474  ·  view source on GitHub ↗

removePeer removes and cleans up a lost peer. It updates all peers it shares a tunnel with, deletes all tunnels from which the removed peer is the source.

(p *peer, closeErr string)

Source from the content-addressed store, hash-verified

460// removePeer removes and cleans up a lost peer. It updates all peers it shares a tunnel with, deletes
461// all tunnels from which the removed peer is the source.
462func (c *core) lostPeer(p *peer, closeErr string) error {
463 c.mutex.Lock()
464 defer c.mutex.Unlock()
465 c.logger.Debug(context.Background(), "lostPeer", slog.F("peer_id", p.id))
466 if c.closed {
467 return ErrClosed
468 }
469 if existing, ok := c.peers[p.id]; !ok || existing != p {
470 return ErrAlreadyRemoved
471 }
472 c.removePeerLocked(p.id, proto.CoordinateResponse_PeerUpdate_LOST, "lost", closeErr)
473 return nil
474}
475
476func (c *core) removePeerLocked(id uuid.UUID, kind proto.CoordinateResponse_PeerUpdate_Kind, reason, closeErr string) {
477 p, ok := c.peers[id]

Callers 1

CoordinateMethod · 0.80

Calls 3

removePeerLockedMethod · 0.95
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected