mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-08-01 01:11:58 +00:00
core/: Concurrent dial attempts (#2248)
Concurrently dial address candidates within a single dial attempt. Main motivation for this feature is to increase success rate on hole punching (see https://github.com/libp2p/rust-libp2p/issues/1896#issuecomment-885894496 for details). Though, as a nice side effect, as one would expect, it does improve connection establishment time. Cleanups and fixes done along the way: - Merge `pool.rs` and `manager.rs`. - Instead of manually implementing state machines in `task.rs` use `async/await`. - Fix bug where `NetworkBehaviour::inject_connection_closed` is called without a previous `NetworkBehaviour::inject_connection_established` (see https://github.com/libp2p/rust-libp2p/issues/2242). - Return handler to behaviour on incoming connection limit error. Missed in https://github.com/libp2p/rust-libp2p/issues/2242.
This commit is contained in:
@@ -492,13 +492,8 @@ mod network {
|
||||
}
|
||||
}
|
||||
SwarmEvent::ConnectionClosed { .. } => {}
|
||||
SwarmEvent::UnreachableAddr {
|
||||
peer_id,
|
||||
attempts_remaining,
|
||||
error,
|
||||
..
|
||||
} => {
|
||||
if attempts_remaining == 0 {
|
||||
SwarmEvent::OutgoingConnectionError { peer_id, error, .. } => {
|
||||
if let Some(peer_id) = peer_id {
|
||||
if let Some(sender) = self.pending_dial.remove(&peer_id) {
|
||||
let _ = sender.send(Err(Box::new(error)));
|
||||
}
|
||||
|
Reference in New Issue
Block a user