Stop idle timer when connection starts to close

Fixes a bug where the stop would get lost when the connection state is
discarded by the endpoint.
This commit is contained in:
Benjamin Saunders
2019-01-19 14:06:02 -08:00
committed by Dirkjan Ochtman
parent 98edfa103f
commit 92f59031de
+4 -1
View File
@@ -516,7 +516,6 @@ impl Connection {
pub fn timeout(&mut self, now: u64, timer: Timer) -> bool {
match timer {
Timer::Close => {
self.io.timer_stop(Timer::Idle);
self.state = State::Drained;
return self.app_closed;
}
@@ -754,6 +753,10 @@ impl Connection {
}
fn reset_idle_timeout(&mut self, now: u64) {
if self.state.is_closed() {
self.io.timer_stop(Timer::Idle);
return;
}
let dt = if self.config.idle_timeout == 0 || self.params.idle_timeout == 0 {
cmp::max(self.config.idle_timeout, self.params.idle_timeout)
} else {