Reset the timer transitioning from TCP FIN-WAIT-1 to FIN-WAIT-2.

We don't transmit anything in FIN-WAIT-2, so we don't need the timer
running, or we'll get spurious log messages about retransmissions.
This also makes logic cleaner, although with no functional change.
This commit is contained in:
whitequark 2017-08-29 19:47:04 +00:00
parent cdf236412f
commit 7cd7bd4683
1 changed files with 2 additions and 6 deletions

View File

@ -992,9 +992,8 @@ impl<'a> TcpSocket<'a> {
(State::FinWait1, TcpControl::None) => {
if ack_of_fin {
self.set_state(State::FinWait2);
} else {
self.timer.reset();
}
self.timer.reset();
}
// FIN packets in FIN-WAIT-1 state change it to CLOSING, or to TIME-WAIT
@ -2073,10 +2072,7 @@ mod test {
..SEND_TEMPL
});
assert_eq!(s.state, State::FinWait2);
sanity!(s, TcpSocket {
timer: Timer::Retransmit { expires_at: 100, delay: 100 },
..socket_fin_wait_2()
});
sanity!(s, socket_fin_wait_2());
}
#[test]