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

fix: dial self #329

Merged
merged 1 commit into from
Apr 10, 2019
Merged

fix: dial self #329

merged 1 commit into from
Apr 10, 2019

Conversation

alanshaw
Copy link
Member

This PR fixes multiple cases where a node would dial itself.

fixes #326

This PR fixes multiple cases where a node would dial itself.

fixes #326

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
@ghost ghost assigned alanshaw Apr 10, 2019
@ghost ghost added the in progress label Apr 10, 2019
return transportAddrs
}

const ourAddrs = peerInfo.multiaddrs.toArray()
return transportAddrs.filter((addr) => {
const ourAddrs = ourAddresses(peerInfo)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if we should create and store this after listening is done, instead of running it before every dial. Our addresses shouldn't change, at the moment, after listening is done. It might save us quite a bit of processing when there are a lot of dials being done.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess we could. It sounds like it would add a bunch of complexity that might easily cause confusion/bugs in the in the future if/when our addresses can change. Can we do it in a separate PR if it's a bottleneck?

Really, a lot of this should go away when addrs don't automatically carry a peer ID.

Copy link
Member

Choose a reason for hiding this comment

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

I am ok with addressing this in a new PR

Copy link
Contributor

Choose a reason for hiding this comment

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

Really, a lot of this should go away when addrs don't automatically carry a peer ID.

That's true, and since it's on my list of things to get to this quarter I think we can move forward with this. The queuing should mitigate the performance impact anyway.

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!

return transportAddrs
}

const ourAddrs = peerInfo.multiaddrs.toArray()
return transportAddrs.filter((addr) => {
const ourAddrs = ourAddresses(peerInfo)
Copy link
Member

Choose a reason for hiding this comment

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

I am ok with addressing this in a new PR

@jacobheun jacobheun merged commit 4862c48 into master Apr 10, 2019
@ghost ghost removed the in progress label Apr 10, 2019
@alanshaw alanshaw deleted the fix/dial-self branch April 10, 2019 15:54
@achingbrain
Copy link
Member

This sounds a bit like the issue I described in libp2p/js-libp2p-floodsub#58 - maybe this has fixed that too

@vasco-santos
Copy link
Member

Can you check if that got fixed @achingbrain ?

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.

Switch allows dial itself
4 participants