Fix handling of unset idle timeout

This commit is contained in:
Benjamin Saunders
2018-10-17 22:19:31 -07:00
parent e66d71d815
commit 10c09ef64f
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -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.
+1 -1
View File
@@ -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.
///