MCPcopy Create free account
hub / github.com/CPChain/chain / AddPeer

Method AddPeer

protocols/cpc/syncer/syncer.go:268–275  ·  view source on GitHub ↗

AddPeer add the peer to the pool

(p SyncPeer)

Source from the content-addressed store, hash-verified

266
267// AddPeer add the peer to the pool
268func (s *Synchronizer) AddPeer(p SyncPeer) error {
269 s.peerMutex.Lock()
270 defer s.peerMutex.Unlock()
271 if len(s.peers) <= 25 {
272 s.peers[p.IDString()] = p
273 }
274 return nil
275}
276
277// RemovePeer remove the peer
278func (s *Synchronizer) RemovePeer(peer string) error {

Callers

nothing calls this directly

Calls 3

LockMethod · 0.80
UnlockMethod · 0.80
IDStringMethod · 0.65

Tested by

no test coverage detected