This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 78301889b2241687f2de68c34b0c0d8e3e2da5a3
Author: raiden00pl <[email protected]>
AuthorDate: Tue Nov 17 20:38:26 2026 +0100

    net/tcp: do not shrink the receive window.
    
    The window follows the free IOBs, so its right edge can move left.
    Since c4494c714ce a segment beyond the edge is dropped before its ACK is
    processed: the peer's ACKs are lost and the connection retransmits
    forever.  Keep the edge (RFC 9293 SHLD-14).
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: raiden00pl <[email protected]>
---
 net/tcp/tcp_send.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/tcp/tcp_send.c b/net/tcp/tcp_send.c
index cdf30630c18..e5f1f90d907 100644
--- a/net/tcp/tcp_send.c
+++ b/net/tcp/tcp_send.c
@@ -161,6 +161,13 @@ void tcp_fill_header(FAR struct net_driver_s *dev,
       uint32_t rcvseq = tcp_getsequence(conn->rcvseq);
       uint32_t recvwndo = tcp_get_recvwindow(dev, conn);
 
+      /* Do not shrink the window (RFC 9293 SHLD-14) */
+
+      if (TCP_SEQ_LT(rcvseq + recvwndo, conn->rcv_adv))
+        {
+          recvwndo = TCP_SEQ_SUB(conn->rcv_adv, rcvseq);
+        }
+
       /* Update the Receiver Window */
 
       conn->rcv_adv = rcvseq + recvwndo;

Reply via email to