@cryptotaxi247 / kubo / commits / 4dd2e8fde

fixed dht kbucket race

closes #836

Juan Batiz-Benet committed Mar 4, 2015 at 08:28 UTC 4dd2e8fde92b42f42159bdb6539b013c515d06a4
1 file changed +2
routing/kbucket/table.go
+2
@@ -185,9 +185,11 @@ func (rt *RoutingTable) NearestPeers(id ID, count int) []peer.ID {
185 // Size returns the total number of peers in the routing table
186 func (rt *RoutingTable) Size() int {
187 var tot int
188 + rt.tabLock.RLock()
189 for _, buck := range rt.Buckets {
190 tot += buck.Len()
191 }
192 + rt.tabLock.RUnlock()
193 return tot
194 }
195