Adjust PeerSet logic in the DHT lookup process #802
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current logic of the
PeerSet
(taking the name from the previousgo-libp2p-core/peer.Set
) defines the result of the lookup process based on the firstAddrInfo
that we discover from the lookup for each provider.We have spotted in
RFM17.1
that this logic would severely impact the effect of extending the provider Multiaddress' TTL#795
, forcing in some occasions to make that second DHT lookup to map thePeerID
with theMaddrs
when it wouldn't be necessary because other PR Holders still have a validMaddrs
.This PR aims to solve that weird behavior from the
PeerSet
by notifying as well whenever a second PR for the same provider comes with theMaddrs
.to go from a lookup result that looks like this (distribution of the content of the PRs as a result of the DHT lookups over time):
to something that looks like this:
Let me know what you think about it.
TODO: I still need to check why the modification doesn't pass the
dht_test.go
test.CC: @yiannisbot @guillaumemichel @dennis-tra