Files
lneto/tcp
Derek den Haas 21f477b86e fix(tcp): retransmit unacknowledged data after a local close (#182)
ControlBlock.Send refused any outgoing segment carrying data in
FIN-WAIT-1, citing RFC 9293's "no further SENDs from the user will be
accepted by the TCP implementation". That rule bounds what the
application may queue, which Handler.Write already enforces, and not the
retransmission of data the connection has already accepted from it.

The consequence is that write-then-close, which is what nearly every
server does with a response, cannot recover from losing its last data
segment. The FIN occupies a sequence number above that data, so the peer
cannot cross the gap to process the close: it waits for bytes that are
never resent while the sender waits for an ACK that cannot arrive.
Neither side times out at the TCP layer.

FIN-WAIT-2 keeps the restriction and gains the reasoning: it is reached
by our FIN being acknowledged, which acknowledges everything below it, so
no unacknowledged data can remain there.

PendingSegment needs the same distinction, since it decides whether to
offer send-buffer data at all; it gets an unexported State predicate
rather than a new exported one.

Two tests, the second red before the change:

  - retransmission after RTO expiry, covering the Handler/LossRecovery
    seam that the RTO unit tests do not reach (they exercise the state
    machine in isolation, where it behaves correctly).
  - retransmission after a close with unacknowledged data.

Co-authored-by: Derek den Haas <i.pestano@easyflor.nl>
2026-08-24 19:36:48 -03:00
..
2026-07-22 13:09:12 -03:00
2026-04-11 18:01:05 -03:00
2026-04-09 09:36:17 -03:00
2026-07-22 13:09:12 -03:00
2026-01-03 12:41:57 -03:00
2026-05-13 15:31:18 -03:00
2026-07-22 13:09:12 -03:00
2026-07-22 13:09:12 -03:00
2026-07-29 20:20:21 -03:00