From 407dd42ee0a6dd0457d5ed3e80f9f3dd3c1d72ed Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Wed, 18 Oct 2023 23:03:49 +1100 Subject: [PATCH] feat(request-response): deprecate `Config::set_connection_keep_alive` We deprecate the `set_connection_keep_alive` function in preparation for removing the `KeepAlive::Until` entirely. This is backwards-compatible. Pull-Request: #4029. --- protocols/perf/src/bin/perf.rs | 3 +- protocols/perf/src/client.rs | 1 - protocols/perf/src/server.rs | 1 - protocols/request-response/CHANGELOG.md | 3 + protocols/request-response/src/lib.rs | 109 +++++++++++++----------- 5 files changed, 63 insertions(+), 54 deletions(-) diff --git a/protocols/perf/src/bin/perf.rs b/protocols/perf/src/bin/perf.rs index 418c7fef97f..42c6a182a57 100644 --- a/protocols/perf/src/bin/perf.rs +++ b/protocols/perf/src/bin/perf.rs @@ -419,7 +419,8 @@ async fn swarm() -> Result> { Default::default(), local_peer_id, Config::with_tokio_executor() - .with_substream_upgrade_protocol_override(upgrade::Version::V1Lazy), + .with_substream_upgrade_protocol_override(upgrade::Version::V1Lazy) + .with_idle_connection_timeout(Duration::from_secs(60 * 5)), ); Ok(swarm) diff --git a/protocols/perf/src/client.rs b/protocols/perf/src/client.rs index 93c2086a49e..6ef671a429a 100644 --- a/protocols/perf/src/client.rs +++ b/protocols/perf/src/client.rs @@ -59,7 +59,6 @@ pub struct Behaviour { impl Default for Behaviour { fn default() -> Self { let mut req_resp_config = request_response::Config::default(); - req_resp_config.set_connection_keep_alive(Duration::from_secs(60 * 5)); req_resp_config.set_request_timeout(Duration::from_secs(60 * 5)); Self { connected: Default::default(), diff --git a/protocols/perf/src/server.rs b/protocols/perf/src/server.rs index 79f77c74650..ea361755ec3 100644 --- a/protocols/perf/src/server.rs +++ b/protocols/perf/src/server.rs @@ -38,7 +38,6 @@ pub struct Behaviour { impl Default for Behaviour { fn default() -> Self { let mut req_resp_config = request_response::Config::default(); - req_resp_config.set_connection_keep_alive(Duration::from_secs(60 * 5)); req_resp_config.set_request_timeout(Duration::from_secs(60 * 5)); Self { diff --git a/protocols/request-response/CHANGELOG.md b/protocols/request-response/CHANGELOG.md index 485fa911396..706e1d9e65f 100644 --- a/protocols/request-response/CHANGELOG.md +++ b/protocols/request-response/CHANGELOG.md @@ -1,5 +1,8 @@ ## 0.25.2 - unreleased +- Deprecate `request_response::Config::set_connection_keep_alive` in favor of `SwarmBuilder::idle_connection_timeout`. + See [PR 4029](https://github.com/libp2p/rust-libp2p/pull/4029). +