Skip to content
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

Merged
merged 1 commit into from
Jul 8, 2020

Conversation

jacobheun
Copy link
Contributor

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.

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
@vasco-santos
Copy link
Member

I would wait for revamping the whole DHT to have that change. But it makes sense to do it!

Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vasco-santos vasco-santos merged commit 578c5d0 into master Jul 8, 2020
@vasco-santos vasco-santos deleted the fix/conn-check branch July 8, 2020 13:47
@vasco-santos
Copy link
Member

Released in 0.19.8

@Strernd
Copy link

Strernd commented Jul 8, 2020

Thanks very much for the quick fix. Really love the work you're doing here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants