From 19dc121a4fd73b8cf4e772de352be97ea2066523 Mon Sep 17 00:00:00 2001 From: Alexander Lunev Date: Sun, 26 Dec 2021 22:50:29 +0300 Subject: [PATCH] net/tcp(unbuffered): fixed an issue with tx_unacked overflow that occurred if NET_TCP_WINDOW_SCALE option was enabled. If the remote TCP receiver advertised TCP window size greater than 64 KB and TCP ACK packets returned to the NuttX TCP sender with a significant delay, tx_unacked variable overflowed and further TCP send stalled forever (until TCP re-connection). --- net/tcp/tcp.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index 245cba1294..a42bfe638b 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -215,7 +215,8 @@ struct tcp_conn_s int32_t snd_bufs; /* Maximum amount of bytes queued in send */ sem_t snd_sem; /* Semaphore signals send completion */ #endif -#ifdef CONFIG_NET_TCP_WRITE_BUFFERS +#if defined(CONFIG_NET_TCP_WRITE_BUFFERS) || \ + defined(CONFIG_NET_TCP_WINDOW_SCALE) uint32_t tx_unacked; /* Number bytes sent but not yet ACKed */ #else uint16_t tx_unacked; /* Number bytes sent but not yet ACKed */