diff --git a/Cargo.lock b/Cargo.lock index 6c64ea3fea7..ec114491e48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2801,7 +2801,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.46.2" +version = "0.47.0" dependencies = [ "async-std", "asynchronous-codec", @@ -3051,7 +3051,7 @@ dependencies = [ [[package]] name = "libp2p-perf" -version = "0.3.1" +version = "0.4.0" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index ab660cc90e9..7fa6856c26b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,7 +82,7 @@ libp2p-core = { version = "0.41.3", path = "core" } libp2p-dcutr = { version = "0.11.1", path = "protocols/dcutr" } libp2p-dns = { version = "0.41.1", path = "transports/dns" } libp2p-floodsub = { version = "0.44.0", path = "protocols/floodsub" } -libp2p-gossipsub = { version = "0.46.2", path = "protocols/gossipsub" } +libp2p-gossipsub = { version = "0.47.0", path = "protocols/gossipsub" } libp2p-identify = { version = "0.45.0", path = "protocols/identify" } libp2p-identity = { version = "0.2.9" } libp2p-kad = { version = "0.46.0", path = "protocols/kad" } @@ -92,7 +92,7 @@ libp2p-metrics = { version = "0.14.2", path = "misc/metrics" } libp2p-mplex = { version = "0.41.0", path = "muxers/mplex" } libp2p-muxer-test-harness = { path = "muxers/test-harness" } libp2p-noise = { version = "0.44.0", path = "transports/noise" } -libp2p-perf = { version = "0.3.1", path = "protocols/perf" } +libp2p-perf = { version = "0.4.0", path = "protocols/perf" } libp2p-ping = { version = "0.44.2", path = "protocols/ping" } libp2p-plaintext = { version = "0.41.0", path = "transports/plaintext" } libp2p-pnet = { version = "0.24.0", path = "transports/pnet" } diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index 970db3f1ec3..7c43b98f0a7 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.47.0 +- Add ConnectionError to FromSwarm::ConnectionClosed. + See [PR 5485](https://github.com/libp2p/rust-libp2p/pull/5485). + ## 0.46.2 - Use `web-time` instead of `instant`. See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index f556443477f..f989e997bfb 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-gossipsub" edition = "2021" rust-version = { workspace = true } description = "Gossipsub protocol for libp2p" -version = "0.46.2" +version = "0.47.0" authors = ["Age Manning "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/gossipsub/src/behaviour/tests.rs b/protocols/gossipsub/src/behaviour/tests.rs index 6cad719b5ab..fe861a674dd 100644 --- a/protocols/gossipsub/src/behaviour/tests.rs +++ b/protocols/gossipsub/src/behaviour/tests.rs @@ -268,6 +268,7 @@ where connection_id, endpoint: &fake_endpoint, remaining_established: active_connections, + cause: None, })); } } diff --git a/protocols/perf/CHANGELOG.md b/protocols/perf/CHANGELOG.md index d83e8b48472..b347f21e9e0 100644 --- a/protocols/perf/CHANGELOG.md +++ b/protocols/perf/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.0 +- Add ConnectionError to FromSwarm::ConnectionClosed. + See [PR 5485](https://github.com/libp2p/rust-libp2p/pull/5485). + ## 0.3.1 - Use `web-time` instead of `instant`. See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). diff --git a/protocols/perf/Cargo.toml b/protocols/perf/Cargo.toml index 4f154ab1b08..abe58088caa 100644 --- a/protocols/perf/Cargo.toml +++ b/protocols/perf/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-perf" edition = "2021" rust-version = { workspace = true } description = "libp2p perf protocol implementation" -version = "0.3.1" +version = "0.4.0" authors = ["Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/perf/src/client/behaviour.rs b/protocols/perf/src/client/behaviour.rs index 880bcdd9c83..5e430f8f0c1 100644 --- a/protocols/perf/src/client/behaviour.rs +++ b/protocols/perf/src/client/behaviour.rs @@ -116,6 +116,7 @@ impl NetworkBehaviour for Behaviour { connection_id: _, endpoint: _, remaining_established, + .. }) => { if remaining_established == 0 { assert!(self.connected.remove(&peer_id)); diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index bdb0b1cd5d0..f4901947b8b 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -10,6 +10,8 @@ See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). - Add `#[track_caller]` on all `spawn` wrappers. See [PR 5465](https://github.com/libp2p/rust-libp2p/pull/5465). +- Add ConnectionError to FromSwarm::ConnectionClosed. + See [PR 5485](https://github.com/libp2p/rust-libp2p/pull/5485). ## 0.44.2 diff --git a/swarm/src/behaviour.rs b/swarm/src/behaviour.rs index fc9045dfc3f..8a8418739c8 100644 --- a/swarm/src/behaviour.rs +++ b/swarm/src/behaviour.rs @@ -32,8 +32,8 @@ use crate::connection::ConnectionId; use crate::dial_opts::DialOpts; use crate::listen_opts::ListenOpts; use crate::{ - ConnectionDenied, ConnectionHandler, DialError, ListenError, THandler, THandlerInEvent, - THandlerOutEvent, + ConnectionDenied, ConnectionError, ConnectionHandler, DialError, ListenError, THandler, + THandlerInEvent, THandlerOutEvent, }; use libp2p_core::{transport::ListenerId, ConnectedPoint, Endpoint, Multiaddr}; use libp2p_identity::PeerId; @@ -481,6 +481,7 @@ pub struct ConnectionClosed<'a> { pub peer_id: PeerId, pub connection_id: ConnectionId, pub endpoint: &'a ConnectedPoint, + pub cause: Option<&'a ConnectionError>, pub remaining_established: usize, } diff --git a/swarm/src/lib.rs b/swarm/src/lib.rs index fb02cdce392..31eb2aa28f5 100644 --- a/swarm/src/lib.rs +++ b/swarm/src/lib.rs @@ -909,6 +909,7 @@ where peer_id, connection_id: id, endpoint: &endpoint, + cause: error.as_ref(), remaining_established: num_established as usize, })); self.pending_swarm_events diff --git a/swarm/src/test.rs b/swarm/src/test.rs index 547277550bb..d49b504392a 100644 --- a/swarm/src/test.rs +++ b/swarm/src/test.rs @@ -301,6 +301,7 @@ where connection_id, endpoint, remaining_established, + cause, }: ConnectionClosed, ) { let mut other_closed_connections = self @@ -350,6 +351,7 @@ where connection_id, endpoint, remaining_established, + cause, })); } }