MCPcopy
hub / github.com/canopy-network/canopy / Has

Method Has

p2p/set.go:274–281  ·  view source on GitHub ↗

Has() returns if the set has a peer with a specific public key

(publicKey []byte)

Source from the content-addressed store, hash-verified

272
273// Has() returns if the set has a peer with a specific public key
274func (ps *PeerSet) Has(publicKey []byte) bool {
275 defer lib.TimeTrack(ps.logger, time.Now(), time.Second)
276 unlock := rlockWithTrace("peerset", &ps.mux, ps.logger)
277 defer unlock()
278 pubKey := lib.BytesToString(publicKey)
279 _, found := ps.m[pubKey]
280 return found
281}
282
283// Stop() stops the entire peer set
284func (ps *PeerSet) Stop() {

Callers 6

TestStartFunction · 0.45
connectStartedNodesFunction · 0.45
newTestP2PPairFunction · 0.45
DialForOutboundPeersMethod · 0.45
DialMethod · 0.45

Calls 3

TimeTrackFunction · 0.92
BytesToStringFunction · 0.92
rlockWithTraceFunction · 0.85

Tested by 3

TestStartFunction · 0.36
connectStartedNodesFunction · 0.36
newTestP2PPairFunction · 0.36