ax(node): replace prose description with usage example on SelectNearestPeers
AX principle 2: comments show HOW with real values, not WHAT the signature already says. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
c8edfee8ae
commit
482b2e6f23
1 changed files with 2 additions and 1 deletions
|
|
@ -508,7 +508,8 @@ func (r *PeerRegistry) SelectOptimalPeer() *Peer {
|
|||
return &peerCopy
|
||||
}
|
||||
|
||||
// SelectNearestPeers returns the n best peers based on multi-factor optimization.
|
||||
// peers := registry.SelectNearestPeers(3) // top 3 peers by ping, hops, geo, score
|
||||
// for _, peer := range peers { ctrl.ConnectToPeer(peer.ID) }
|
||||
func (r *PeerRegistry) SelectNearestPeers(n int) []*Peer {
|
||||
r.mutex.RLock()
|
||||
defer r.mutex.RUnlock()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue