Skip to content

Commit

Permalink
corrected fixRTIfNeeded call location to pass TestRefreshBelowMinRTTh…
Browse files Browse the repository at this point in the history
…reshold
  • Loading branch information
guillaumemichel committed Jun 15, 2023
1 parent 01391f5 commit ae70be5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,10 @@ func (dht *IpfsDHT) rtPeerLoop() {
// peer not added.
continue
}
if !newlyAdded {
if newlyAdded {
// peer was added to the RT, it can now be fixed if needed.
dht.fixRTIfNeeded()
} else {
// the peer is already in our RT, but we just successfully queried it and so let's give it a
// bump on the query time so we don't ping it too soon for a liveliness check.
dht.routingTable.UpdateLastSuccessfulOutboundQueryAt(p, time.Now())
Expand Down
1 change: 0 additions & 1 deletion subscriber_notifee.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ func handlePeerChangeEvent(dht *IpfsDHT, p peer.ID) {
return
} else if valid {
dht.peerFound(p)
dht.fixRTIfNeeded()
} else {
dht.peerStoppedDHT(p)
}
Expand Down

0 comments on commit ae70be5

Please sign in to comment.