Commit 5f313283 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

fixed dht kbucket race

closes #836
parent 7f2386b9
......@@ -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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment