-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use Multiaddr
instead of ConnectedPoint
in DialError::WrongPeerId
#2793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
dmitry-markin
wants to merge
2
commits into
libp2p:master
from
dmitry-markin:fix-dial-error-wrong-peer-id
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a
panic
at runtime I would prefer making this state impossible at compile time.Would splitting
PendingConnectionError
be an option @dmitry-markin?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this seems reasonable, I'll try to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can replace
rust-libp2p/swarm/src/connection/pool.rs
Lines 622 to 731 in a4110a2
PendingPoint::Dialer
&PendingPoint::Listener
, duplicating common code on lines 651-706 for each branch. This way there will be no ambiguity whether we are handlingDialer
orListener
related errors. We'll also need to duplicate code in https://github.com/libp2p/rust-libp2p/blob/a4110a2b6939d5b460f11df6dd158308f517becf/swarm/src/connection/error.rs forPendingInboundConnectionError
&PendingOutboundConnectionError
, which won't have the common base after these changes.I can't weigh the code duplication vs panicking in impossible branch in this case. Should I proceed in the way described above @mxinden?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would hope that we could do without the duplication here. Though I would have to play around with it myself.
👍 Off the top of my head, that seems reasonable to me.
Note that some of this might change in the near future with #2824. One potential implementation may be #2828, though as you can see that is still work in progress.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I wait for #2828 to be merged before implementing the approach proposed above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that is a good idea. 🙏
In case you are interested in contributing in the meantime, many of the help wanted issues don't conflict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#2824 is now resolved although with a different approach than in #2828 in case you want to revive this PR @dmitry-markin.