From 7cd7bd46830d1e8a16ac8718c9579df9671a1aed Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 29 Aug 2017 19:47:04 +0000 Subject: [PATCH] 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. --- src/socket/tcp.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/socket/tcp.rs b/src/socket/tcp.rs index 3e8becd..d2ed1b4 100644 --- a/src/socket/tcp.rs +++ b/src/socket/tcp.rs @@ -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]