-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: don't add unresponsive DHT servers to the Routing Table #820
fix: don't add unresponsive DHT servers to the Routing Table #820
Conversation
8549334
to
5362e55
Compare
@Jorropo I fixed a flaw but some tests are still failing:
For |
Just opened a PR in go-libp2p-kbucket. We need a function to test whether a peer.ID would be useful to the Routing Table, so that we don't bother sending requests to useless peers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a high level surface review, I'll rereview in depth once high level code quality is fixed.
f67dfa9
to
5e2ef88
Compare
@guillaumemichel is this ready for a second round of reviews from @Jorropo so that we schedule it for one of the upcoming releases? |
@guillaumemichel : what are the next steps here? |
I am still waiting on a review from @Jorropo for this PR and for libp2p/go-libp2p-kbucket#113 on which it depends. |
10fbf09
to
f083cb3
Compare
Also please resolve your conflicts. |
Per 2023-06-08 maintainer conversation: @Jorropo is going to take having this code all ready to go so that @guillaumemichel can review it first-thing 2023-06-12 when he returns so that the Kubo 0.21 release can happen afterwards. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Ty <3
* added check to avoid adding unresponsive dht peers to the dht routing table * removed lock in adding peers to the rt * made variable names more meaningful * fixed network loop and corrected tests * added UsefulPeer() references from current PR * go mod tidy * added delay in TestRefreshBelowMinRTThreshold * addressed review * go mod tidy * addressed Jorropo review * added comments * removed state of peers probed recently * fix conflicts merge * updated deps * added optimizations documentation * Update dht.go * updated md files --------- Co-authored-by: Jorropo <jorropo.pgm@gmail.com>
* added check to avoid adding unresponsive dht peers to the dht routing table * removed lock in adding peers to the rt * made variable names more meaningful * fixed network loop and corrected tests * added UsefulPeer() references from current PR * go mod tidy * added delay in TestRefreshBelowMinRTThreshold * addressed review * go mod tidy * addressed Jorropo review * added comments * removed state of peers probed recently * fix conflicts merge * updated deps * added optimizations documentation * Update dht.go * updated md files --------- Co-authored-by: Jorropo <jorropo.pgm@gmail.com> (cherry picked from commit 8c9fdff)
Partial revert of #2499 If a node is queried for it's own peer id, return it's own peer info. This is necessary because since libp2p/go-libp2p-kad-dht#820 go-libp2p-kad-dht won't add a peer to it's routing tables that doesn't have any DHT peers that are KAD-futher from it's own ID already.
Partial revert of #2499 If a node is queried for it's own peer id, return it's own peer info. This is necessary because since libp2p/go-libp2p-kad-dht#820 go-libp2p-kad-dht won't add a peer to it's routing tables that doesn't have any DHT peers that are KAD-futher from it's own ID already.
PR addressing #811
Change summary:
lookupCheck
function to theIpfsDHT
. This function consists in making a DHT FindPeer request to a peer, asking it for its own peer.ID https://github.com/guillaumemichel/go-libp2p-kad-dht/blob/cdd6898b8a9d41a1abce803325c98a14083013d6/dht.go#L327-L336validPeerFound
function, acting like the previouspeerFound
function, but assuming the given peer was just queried https://github.com/guillaumemichel/go-libp2p-kad-dht/blob/cdd6898b8a9d41a1abce803325c98a14083013d6/dht.go#L664-L676peerFound
performs thevalidRTPeer
check and runsprotocolCheck
. Upon success it callsvalidPeerFound
https://github.com/guillaumemichel/go-libp2p-kad-dht/blob/cdd6898b8a9d41a1abce803325c98a14083013d6/dht.go#L639-L662validPeerFound
https://github.com/guillaumemichel/go-libp2p-kad-dht/blob/cdd6898b8a9d41a1abce803325c98a14083013d6/query.go#L419-L420IpfsDHT
has a newrecentlyCheckedPeers
attribute, amap
of the peerids contacted in the lastlookupCheckInterval
(5 seconds by default). It prevents network loops, e.g A sends a request to B, B wants to add A in its RT, B sends a request to A before adding it to its RT, A gets the requests and want to add B in its RT so it sends a new request to B, etc. If we tried to add a peer to the RT less than 5 seconds ago, we won't try again.Todo