From 5b6c814f44ea81a8be276f618a58e2622f027184 Mon Sep 17 00:00:00 2001 From: leonz Date: Sat, 14 Oct 2023 23:28:46 +0800 Subject: [PATCH 1/4] deprecate config idle_timeout --- Cargo.lock | 2 +- Cargo.toml | 2 +- protocols/gossipsub/Cargo.toml | 2 +- protocols/gossipsub/src/config.rs | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7b1defcea3c..91fc4616375 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2581,7 +2581,7 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.45.1" +version = "0.45.2" dependencies = [ "async-std", "asynchronous-codec", diff --git a/Cargo.toml b/Cargo.toml index 587b8970d1f..b9934d4d613 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -81,7 +81,7 @@ libp2p-dcutr = { version = "0.10.0", path = "protocols/dcutr" } libp2p-deflate = { version = "0.40.1", path = "transports/deflate" } libp2p-dns = { version = "0.40.1", path = "transports/dns" } libp2p-floodsub = { version = "0.43.0", path = "protocols/floodsub" } -libp2p-gossipsub = { version = "0.45.1", path = "protocols/gossipsub" } +libp2p-gossipsub = { version = "0.45.2", path = "protocols/gossipsub" } libp2p-identify = { version = "0.43.1", path = "protocols/identify" } libp2p-identity = { version = "0.2.5" } libp2p-kad = { version = "0.44.6", path = "protocols/kad" } diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index 4f9fd2fa9d3..7a983d66c99 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.45.1" +version = "0.45.2" authors = ["Age Manning "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/gossipsub/src/config.rs b/protocols/gossipsub/src/config.rs index a5d31071538..8ca1d4044f3 100644 --- a/protocols/gossipsub/src/config.rs +++ b/protocols/gossipsub/src/config.rs @@ -186,6 +186,9 @@ impl Config { /// The time a connection is maintained to a peer without being in the mesh and without /// send/receiving a message from. Connections that idle beyond this timeout are disconnected. /// Default is 120 seconds. + #[deprecated( + note = "Set a global idle connection timeout via `SwarmBuilder::idle_connection_timeout` instead." + )] pub fn idle_timeout(&self) -> Duration { self.idle_timeout } From 86d0512368f4f33adcc6f55a038d78c144ac8d8d Mon Sep 17 00:00:00 2001 From: leonz Date: Sat, 14 Oct 2023 23:35:18 +0800 Subject: [PATCH 2/4] add changelog --- protocols/gossipsub/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index a1f4ef6c973..e8e216e29ca 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -1,3 +1,10 @@ +## 0.45.2 - unreleased + +- Deprecate `gossipsub::Config::idle_timeout` in favor of `SwarmBuilder::idle_connection_timeout`. + See [PR 4648]. + +[PR 4648]: (https://github.com/libp2p/rust-libp2p/pull/4648) + ## 0.45.1 - Add getter function to obtain `TopicScoreParams`. From 7ff11f34c6ae90286ed6dcbb50a300d514cce674 Mon Sep 17 00:00:00 2001 From: leonz Date: Sun, 15 Oct 2023 11:44:35 +0800 Subject: [PATCH 3/4] add allow deprecated for passing CI --- protocols/gossipsub/src/config.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/protocols/gossipsub/src/config.rs b/protocols/gossipsub/src/config.rs index 8ca1d4044f3..3e2c8824295 100644 --- a/protocols/gossipsub/src/config.rs +++ b/protocols/gossipsub/src/config.rs @@ -189,6 +189,7 @@ impl Config { #[deprecated( note = "Set a global idle connection timeout via `SwarmBuilder::idle_connection_timeout` instead." )] + #[allow(deprecated)] pub fn idle_timeout(&self) -> Duration { self.idle_timeout } From 8b565ea97b899daa4f1004b07196c66af7ff0e22 Mon Sep 17 00:00:00 2001 From: leonz Date: Sun, 15 Oct 2023 15:41:13 +0800 Subject: [PATCH 4/4] fix allow deprecated for CI --- protocols/gossipsub/src/behaviour.rs | 2 ++ protocols/gossipsub/src/config.rs | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index 402420f378e..2dea607d485 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -3305,6 +3305,7 @@ where type ConnectionHandler = Handler; type ToSwarm = Event; + #[allow(deprecated)] fn handle_established_inbound_connection( &mut self, _: ConnectionId, @@ -3318,6 +3319,7 @@ where )) } + #[allow(deprecated)] fn handle_established_outbound_connection( &mut self, _: ConnectionId, diff --git a/protocols/gossipsub/src/config.rs b/protocols/gossipsub/src/config.rs index 3e2c8824295..8ca1d4044f3 100644 --- a/protocols/gossipsub/src/config.rs +++ b/protocols/gossipsub/src/config.rs @@ -189,7 +189,6 @@ impl Config { #[deprecated( note = "Set a global idle connection timeout via `SwarmBuilder::idle_connection_timeout` instead." )] - #[allow(deprecated)] pub fn idle_timeout(&self) -> Duration { self.idle_timeout }