From 2c6de5a4fc1faa283a54673af9f3919734a57cd9 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 6 Dec 2021 13:55:53 +0100 Subject: [PATCH 1/3] Update libp2p: 0.39.1 -> 0.40.0 Signed-off-by: Matthias Beyer --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1f236d6f4..00d79da67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ either = { default-features = false, version = "1.5" } futures = { default-features = false, version = "0.3.9", features = ["alloc", "std"] } hash_hasher = "2.0.3" ipfs-unixfs = { version = "0.2", path = "unixfs" } -libp2p = { default-features = false, features = ["floodsub", "identify", "kad", "tcp-tokio", "mplex", "noise", "ping", "yamux", "dns-tokio"], version = "0.39.1" } +libp2p = { default-features = false, features = ["floodsub", "identify", "kad", "tcp-tokio", "mplex", "noise", "ping", "yamux", "dns-tokio"], version = "0.40.0" } multibase = { default-features = false, version = "0.9" } multihash = { default-features = false, version = "0.11" } prost = { default-features = false, version = "0.8" } From 167084f377c0e7ab7526905bed2a05b57fa33efd Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 6 Dec 2021 13:56:09 +0100 Subject: [PATCH 2/3] Fix module path Signed-off-by: Matthias Beyer --- src/p2p/behaviour.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p2p/behaviour.rs b/src/p2p/behaviour.rs index d3a813c9c..e2fa4d30e 100644 --- a/src/p2p/behaviour.rs +++ b/src/p2p/behaviour.rs @@ -377,7 +377,7 @@ impl NetworkBehaviourEventProcess for Behaviour< impl NetworkBehaviourEventProcess for Behaviour { fn inject_event(&mut self, event: PingEvent) { - use libp2p::ping::handler::{PingFailure, PingSuccess}; + use libp2p::ping::{PingFailure, PingSuccess}; match event { PingEvent { peer, From dad189cf46b8513dcda9c00c9004d6f8eb9383a3 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 23 Dec 2021 11:36:13 +0100 Subject: [PATCH 3/3] Remove inject_addr_reach_failure() which was removed Signed-off-by: Matthias Beyer --- src/p2p/pubsub.rs | 10 ---------- src/p2p/swarm.rs | 31 ------------------------------- 2 files changed, 41 deletions(-) diff --git a/src/p2p/pubsub.rs b/src/p2p/pubsub.rs index 4aa6e4e43..2bab0ca34 100644 --- a/src/p2p/pubsub.rs +++ b/src/p2p/pubsub.rs @@ -286,16 +286,6 @@ impl NetworkBehaviour for Pubsub { self.floodsub.inject_event(peer_id, connection, event) } - fn inject_addr_reach_failure( - &mut self, - peer_id: Option<&PeerId>, - addr: &Multiaddr, - error: &dyn std::error::Error, - ) { - self.floodsub - .inject_addr_reach_failure(peer_id, addr, error) - } - fn inject_dial_failure(&mut self, peer_id: &PeerId) { self.floodsub.inject_dial_failure(peer_id) } diff --git a/src/p2p/swarm.rs b/src/p2p/swarm.rs index e46914de7..882635387 100644 --- a/src/p2p/swarm.rs +++ b/src/p2p/swarm.rs @@ -355,37 +355,6 @@ impl NetworkBehaviour for SwarmApi { } } - fn inject_addr_reach_failure( - &mut self, - peer_id: Option<&PeerId>, - addr: &Multiaddr, - error: &dyn std::error::Error, - ) { - trace!("inject_addr_reach_failure {} {}", addr, error); - - if let Some(peer_id) = peer_id { - match self.pending_connections.entry(*peer_id) { - Entry::Occupied(mut oe) => { - let addresses = oe.get_mut(); - let addr = MultiaddrWithPeerId::try_from(addr.clone()) - .expect("dialed address contains peerid in libp2p 0.38"); - let pos = addresses.iter().position(|a| *a == addr); - - if let Some(pos) = pos { - addresses.swap_remove(pos); - self.connect_registry - .finish_subscription(addr.into(), Err(error.to_string())); - } - - if addresses.is_empty() { - oe.remove(); - } - } - Entry::Vacant(_) => {} - } - } - } - fn poll( &mut self, _: &mut Context,