diff --git a/quinn-proto/src/connection.rs b/quinn-proto/src/connection.rs index 5fac53b91..859a41908 100644 --- a/quinn-proto/src/connection.rs +++ b/quinn-proto/src/connection.rs @@ -692,8 +692,12 @@ impl Connection { } pub fn reset_idle_timeout(&mut self, config: &Config, now: u64) { - let dt = cmp::min(config.idle_timeout, self.params.idle_timeout) as u64 * 1_000_000; - self.set_idle = Some(Some(now + dt)); + let dt = if config.idle_timeout == 0 || self.params.idle_timeout == 0 { + cmp::max(config.idle_timeout, self.params.idle_timeout) + } else { + cmp::min(config.idle_timeout, self.params.idle_timeout) + }; + self.set_idle = Some(Some(now + dt as u64 * 1_000_000)); } /// Consider all previously transmitted handshake packets to be delivered. Called when we receive a new handshake packet. diff --git a/quinn-proto/src/endpoint.rs b/quinn-proto/src/endpoint.rs index b37bbb10b..79a2fef47 100644 --- a/quinn-proto/src/endpoint.rs +++ b/quinn-proto/src/endpoint.rs @@ -32,7 +32,7 @@ pub struct Config { pub max_remote_uni_streams: u16, /// Maximum duration of inactivity to accept before timing out the connection (s). /// - /// Maximum value is 600 seconds. The actual value used is the minimum of this and the peer's own idle timeout. + /// Maximum value is 600 seconds. The actual value used is the minimum of this and the peer's own idle timeout. 0 for none. pub idle_timeout: u16, /// Maximum number of bytes the peer may transmit on any one stream before becoming blocked. ///