From 1f3ee83134c8aca5a769d4a0de830be663045e7d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 11 May 2015 07:14:25 -0600 Subject: [PATCH] Increase the size of the number of bytes sent from uint16_t to uint32_t in order to avoid TCP errors with long sessions. For exmple: int hello_main(int argc, char *argv[]) { uint32_t i; for(i = 0; i < 65536; i++) { printf("Hello, World!!\n"); } printf("press any key!!\n"); if (getchar()=='t') return 0; else return 1; } When ran in a Telnet session, the "press any key" is not displayed because the tcp session closed unexpectedly with: tcp_input: ERROR: conn->sndseq xx, conn->unacked xx" This is fixed by increasing the width of conn->sent to 32-bits to prevent overflow. From Rony XLN --- net/tcp/tcp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index 6fa263d4b75..f5e201699f6 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -164,7 +164,7 @@ struct tcp_conn_s sq_queue_t unacked_q; /* Write buffering for un-ACKed segments */ uint16_t expired; /* Number segments retransmitted but not yet ACKed, * it can only be updated at TCP_ESTABLISHED state */ - uint16_t sent; /* The number of bytes sent (ACKed and un-ACKed) */ + uint32_t sent; /* The number of bytes sent (ACKed and un-ACKed) */ uint32_t isn; /* Initial sequence number */ #endif