mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-26 21:07:45 +08:00
parent
04a3a66c6c
commit
4dd2e8fde9
@ -185,9 +185,11 @@ func (rt *RoutingTable) NearestPeers(id ID, count int) []peer.ID {
|
||||
// Size returns the total number of peers in the routing table
|
||||
func (rt *RoutingTable) Size() int {
|
||||
var tot int
|
||||
rt.tabLock.RLock()
|
||||
for _, buck := range rt.Buckets {
|
||||
tot += buck.Len()
|
||||
}
|
||||
rt.tabLock.RUnlock()
|
||||
return tot
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user