-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Permit concurrent dialing attempts per peer. #1506
Merged
Merged
Conversation
This file contains 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 was referenced Mar 23, 2020
59021b6
to
3f63934
Compare
This is a follow-up to libp2p#1440 and relates to libp2p#925. This change permits multiple dialing attempts per peer. Note though that `libp2p-swarm` does not yet make use of this ability, retaining the current behaviour. The essence of the changes are that the `Peer` API now provides `Peer::dial()`, i.e. regardless of the state in which the peer is. A dialing attempt is always made up of one or more addresses tried sequentially, as before, but now there can be multiple dialing attempts per peer. A configurable per-peer limit for outgoing connections and thus concurrent dialing attempts is also included.
For a cleaner API and to treat the case of no addresses for a peer as an error, such that a `NetworkBehaviourAction::DialPeer` request is always matched up with either `inject_connection_established` or `inject_dial_error`.
88a1562
to
b73f54a
Compare
twittner
reviewed
Apr 22, 2020
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.
Looks good to me but conflicts need to be resolved.
I integrated the latest changes from master. |
twittner
approved these changes
May 6, 2020
Thanks for the review. I still need to update the changelog, but otherwise if there are no further objections / comments by next Monday, I plan to merge this then. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a follow-up to #1440 and relates to #925. This PR permits multiple dialing attempts per peer. The essence of the changes are that the
Peer
API inlibp2p-core
now providesPeer::dial()
, i.e. regardless of the state in which the peer is. Previously dialing was only permitted on aConnectedPeer
orDisconnectedPeer
. A dialing attempt is always made up of one or more addresses tried sequentially, as before, but now there can be multiple dialing attempts per peer. A configurable per-peer limit for outgoing connections and thus concurrent dialing attempts is also included. ANetworkBehaviour
can now always request a new dialing attempt viaDialPeerCondition::Always
inNetworkBehaviourAction::DialPeer
.Another change included here is that
Swarm::dial
now returnsResult<(), DialError>
instead ofResult<bool, ConnectionLimit>
, i.e. the case of dialing failing becauseNetworkBehaviour::addresses_of_peer
returning no addresses is now treated as an error (DialError::NoAddresses
). This has the (I think) desirable effect of having aNetworkBehaviourAction::DialPeer
request always be paired with a final call toinject_connection_established
orinject_dial_failure
. A behaviour may otherwise potentially keep state around for a dialing attempt that it thinks it emitted but for which it never got informed about a result.