This repository was archived by the owner on Jul 21, 2023. It is now read-only.
fix: check for an existing connection before using the dialer #199
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.
Ideally libp2p should just get passed to the DHT and dial should be used, instead of interacting with the dialer. Currently the dialer does not check for existing connections, like libp2p.dial() does.
This issue was found at https://discuss.libp2p.io/t/random-walk-peer-discovery-adds-connections-to-same-peer/584/2. I tested the change against the sample code shared and it kept the connection count at 1 per peer.
We should probably look at updated the constructor in libp2p 0.29 to just take libp2p, instead of passing numerous components, and make that breaking change here to accompany it. We could also wait for the DHT updates before doing this.