mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-22 19:24:08 +00:00
Fix handling of unset idle timeout
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user