diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index cb003f2d..02f06c5b 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 bcbfae9c..473aa507 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),