-
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
{core,swarm}: Allow configuring dial concurrency factor per dial #2385
Labels
difficulty:easy
getting-started
Issues that can be tackled if you don't know the internals of libp2p very well
help wanted
Comments
mxinden
added a commit
to mxinden/rust-libp2p
that referenced
this issue
Dec 28, 2021
Enable a `NetworkBehaviour` or a user via `Swarm::dial` to override the dial concurrency factor per dial. To enable the above, this commit: - Introduces `libp2p_core::DialOpts` mirroring `libp2p_swarm::DialOpts`. Passed as an argument to `Network::dial`. - Removes `Peer::dial` in favor of `Network::dial`. - Simplifies `Swarm::dial_with_handler`. Fixes libp2p#2385.
mxinden
added a commit
to mxinden/rust-libp2p
that referenced
this issue
Dec 28, 2021
Enable a `NetworkBehaviour` or a user via `Swarm::dial` to override the dial concurrency factor per dial. This is especially relevant in the case of libp2p-autonat where one wants to probe addresses in sequence to reduce the amount of work a remote peer can force onto the local node. To enable the above, this commit also: - Introduces `libp2p_core::DialOpts` mirroring `libp2p_swarm::DialOpts`. Passed as an argument to `Network::dial`. - Removes `Peer::dial` in favor of `Network::dial`. - Simplifies `Swarm::dial_with_handler`. The introduction of `libp2p_core::DialOpts` will be useful beyond this feature, e.g. for libp2p#2363. In the long run I would like to move and merge `libp2p_core::Network` and `libp2p_core::Pool` into `libp2p_swarm::Swarm` thus deduplicating `libp2p_core::DialOpts` and `libp2p_swarm::DialOpts`. Fixes libp2p#2385.
mxinden
added a commit
to mxinden/rust-libp2p
that referenced
this issue
Dec 28, 2021
Enable a `NetworkBehaviour` or a user via `Swarm::dial` to override the dial concurrency factor per dial. This is especially relevant in the case of libp2p-autonat where one wants to probe addresses in sequence to reduce the amount of work a remote peer can force onto the local node. To enable the above, this commit also: - Introduces `libp2p_core::DialOpts` mirroring `libp2p_swarm::DialOpts`. Passed as an argument to `Network::dial`. - Removes `Peer::dial` in favor of `Network::dial`. - Simplifies `Swarm::dial_with_handler`. The introduction of `libp2p_core::DialOpts` will be useful beyond this feature, e.g. for libp2p#2363. In the long run I would like to move and merge `libp2p_core::Network` and `libp2p_core::Pool` into `libp2p_swarm::Swarm` thus deduplicating `libp2p_core::DialOpts` and `libp2p_swarm::DialOpts`. Fixes libp2p#2385.
mxinden
added a commit
that referenced
this issue
Jan 13, 2022
) Enable a `NetworkBehaviour` or a user via `Swarm::dial` to override the dial concurrency factor per dial. This is especially relevant in the case of libp2p-autonat where one wants to probe addresses in sequence to reduce the amount of work a remote peer can force onto the local node. To enable the above, this commit also: - Introduces `libp2p_core::DialOpts` mirroring `libp2p_swarm::DialOpts`. Passed as an argument to `Network::dial`. - Removes `Peer::dial` in favor of `Network::dial`. - Simplifies `Swarm::dial_with_handler`. The introduction of `libp2p_core::DialOpts` will be useful beyond this feature, e.g. for #2363. In the long run I would like to move and merge `libp2p_core::Network` and `libp2p_core::Pool` into `libp2p_swarm::Swarm` thus deduplicating `libp2p_core::DialOpts` and `libp2p_swarm::DialOpts`. Fixes #2385.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
difficulty:easy
getting-started
Issues that can be tackled if you don't know the internals of libp2p very well
help wanted
Today the dial concurrency factor can be set global and for once.
rust-libp2p/swarm/src/lib.rs
Lines 1241 to 1245 in b6c82a4
I argue a
NetworkBehaviour
should be able to configure the factor for each dial individually.While it is necessary to dial concurrently when hole punching to increase success rate, I don't think this should be the case for
libp2p-autonat
when probing someones addresses. In other words, to reduce the amount of work a remote node can make the local node do at a time, I think the local node should probe the remotes addresses in sequence and not in parallel. In order to be able to do so,libp2p-autonat
needs to be able to set the dial concurrency factor to0
for probe dials.@elenaf9 would you agree with the above?
#2363 already adds a new parameter to
Network::dial
, namelyrole_override
. Instead of adding yet another one, it might be time to haveNetwork::dial
take aDialOpts
like e.g.Swarm::dial
does.The text was updated successfully, but these errors were encountered: