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
This commit is contained in:
Gregory Nutt 2015-05-11 07:14:25 -06:00
parent c7a02488c6
commit 1f3ee83134
1 changed files with 1 additions and 1 deletions

View File

@ -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