Skip to content

Commit

Permalink
Merge pull request #122 from libp2p/fix-abba-bug
Browse files Browse the repository at this point in the history
fix: fix abba bug in UsefullNewPeer
  • Loading branch information
guillaumemichel authored Jun 15, 2023
2 parents 365002e + d7ca005 commit 437b9fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions table.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ func (rt *RoutingTable) UsefulNewPeer(p peer.ID) bool {
rt.tabLock.RLock()
defer rt.tabLock.RUnlock()

if rt.Find(p) != "" {
// peer already exists in the routing table, so it isn't useful
return false
}

// bucket corresponding to p
bucketID := rt.bucketIdForPeer(p)
bucket := rt.buckets[bucketID]

if bucket.getPeer(p) != nil {
// peer already exists in the routing table, so it isn't useful
return false
}

// bucket isn't full
if bucket.len() < rt.bucketsize {
return true
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "v0.6.2"
"version": "v0.6.3"
}

0 comments on commit 437b9fc

Please sign in to comment.