MCPcopy Create free account
hub / github.com/tailscale/tailscale / patchifyPeer

Method patchifyPeer

control/controlclient/map.go:962–974  ·  view source on GitHub ↗

patchifyPeer returns a *tailcfg.PeerChange of the session's existing copy of the n.ID Node to n. It returns ok=false if a patch can't be made, (V, ok) on a delta, or (nil, true) if all the fields were identical (a zero change).

(n *tailcfg.Node, onFalse func(string))

Source from the content-addressed store, hash-verified

960// It returns ok=false if a patch can't be made, (V, ok) on a delta, or (nil,
961// true) if all the fields were identical (a zero change).
962func (ms *mapSession) patchifyPeer(n *tailcfg.Node, onFalse func(string)) (_ *tailcfg.PeerChange, ok bool) {
963 ms.peersMu.RLock()
964 defer ms.peersMu.RUnlock()
965
966 was, ok := ms.peers[n.ID]
967 if !ok {
968 if onFalse != nil {
969 onFalse("peer_not_found")
970 }
971 return nil, false
972 }
973 return peerChangeDiff(was, n, onFalse)
974}
975
976// peerChangeDiff returns the difference from 'was' to 'n', if possible.
977//

Callers 1

patchifyPeersChangedMethod · 0.95

Calls 1

peerChangeDiffFunction · 0.85

Tested by

no test coverage detected