From 203e11c1c85930dcfb1a6ef7df8dc16f5aaf762a Mon Sep 17 00:00:00 2001 From: Leonz Date: Wed, 18 Oct 2023 04:41:04 +0800 Subject: [PATCH] feat(swarm): deprecated `keep_alive_timeout` from `OneShotHandlerConfig` Related: #3844. Related: #4677 Pull-Request: #4680. --- swarm/CHANGELOG.md | 2 ++ swarm/src/handler/one_shot.rs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index cb003f2da4f..02f06c5bd26 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -10,6 +10,8 @@ Individual protocols should not keep connections alive for longer than necessary. Users should use `swarm::Config::idle_connection_timeout` instead. See [PR 4656](https://github.com/libp2p/rust-libp2p/pull/4656). +- Deprecate `keep_alive_timeout` in `OneShotHandlerConfig`. + See [PR 4680](https://github.com/libp2p/rust-libp2p/pull/4680). [PR 4120]: https://github.com/libp2p/rust-libp2p/pull/4120 diff --git a/swarm/src/handler/one_shot.rs b/swarm/src/handler/one_shot.rs index bcbfae9c7b5..473aa50798c 100644 --- a/swarm/src/handler/one_shot.rs +++ b/swarm/src/handler/one_shot.rs @@ -233,6 +233,9 @@ where #[derive(Debug)] pub struct OneShotHandlerConfig { /// Keep-alive timeout for idle connections. + #[deprecated( + note = "Set a global idle connection timeout via `SwarmBuilder::idle_connection_timeout` instead." + )] pub keep_alive_timeout: Duration, /// Timeout for outbound substream upgrades. pub outbound_substream_timeout: Duration, @@ -241,6 +244,7 @@ pub struct OneShotHandlerConfig { } impl Default for OneShotHandlerConfig { + #[allow(deprecated)] fn default() -> Self { OneShotHandlerConfig { keep_alive_timeout: Duration::from_secs(10),