From 42dc04852b133464b4d30c7870c60a8717d4041a Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Fri, 18 Dec 2020 16:26:41 +0100 Subject: [PATCH] tcp: allow sending ACKs in FinWait2 state. --- src/socket/tcp.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/socket/tcp.rs b/src/socket/tcp.rs index b4a5f66..ddf845e 100644 --- a/src/socket/tcp.rs +++ b/src/socket/tcp.rs @@ -1574,8 +1574,9 @@ impl<'a> TcpSocket<'a> { } } - // We do not transmit anything in the FIN-WAIT-2 state. - State::FinWait2 => return Err(Error::Exhausted), + // We do not transmit data in the FIN-WAIT-2 state, but we may transmit + // ACKs for incoming data. + State::FinWait2 => {} // We do not transmit data or control flags in the CLOSING or TIME-WAIT states, // but we may retransmit an ACK. @@ -3093,6 +3094,11 @@ mod test { assert_eq!(data, b"abc"); (3, ()) }).unwrap(); + recv!(s, [TcpRepr { + seq_number: LOCAL_SEQ + 1 + 1, + ack_number: Some(REMOTE_SEQ + 1 + 3), + ..RECV_TEMPL + }]); } #[test]