Skip to content
This repository has been archived by the owner on Aug 23, 2019. It is now read-only.

fix: dont dial an address that we have #284

Merged
merged 1 commit into from
Nov 15, 2018
Merged

fix: dont dial an address that we have #284

merged 1 commit into from
Nov 15, 2018

Conversation

jacobheun
Copy link
Contributor

This PR filters out dialable addresses that match our addresses. This will help prevent us from dialing ourselves.

This currently only handles strict equality. As we improve listen versus announce addresses, this should be improved to reflect that.

relates to libp2p/js-libp2p#274

vasco-santos
vasco-santos previously approved these changes Nov 12, 2018
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
Copy link
Member

@jacobheun seems like there are some problems with the tests

@jacobheun
Copy link
Contributor Author

Yep, looking into it.

@blakebyrnes
Copy link

Is it worth using ipfs format for the test? I believe the addresses related to the issue logged on js-libp2p project will have duplicate ip and port, but different peerId (libp2p/js-libp2p#274)

@jacobheun
Copy link
Contributor Author

@vasco-santos looks like the latest secio is causing some odd behaviors on linux, I'm working on getting those resolved.

@blakebyrnes great point, I'll add some more verbose testing of addresses to this once I resolve the other issue.

@jacobheun
Copy link
Contributor Author

I've updated the logic here and expanded the addresses a bit. Doing a comparison of the host and port is problematic as they're not easy to get from the addresses without more complex logic. This now attempts to use multiaddr's decapsulate functionality to find our address in the address to be dialed. If it's there, we avoid dialing. This isn't a perfect solution but should help mitigate some of the self dials until we add libp2p/js-libp2p#202 and can do better checking.

This needs #285 to resolve the issue with the tests.

@jacobheun
Copy link
Contributor Author

@vasco-santos ci is green, this is ready for a re-review. Thanks!

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

@jacobheun jacobheun merged commit f406dd5 into master Nov 15, 2018
@jacobheun jacobheun deleted the fix/dial-self branch November 15, 2018 12:00
@ghost ghost removed the in progress label Nov 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants