diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index d61a4f62b0..b4635a88b9 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -684,9 +684,7 @@ found: { uint32_t unackseq; uint32_t ackseq; -#ifdef CONFIG_NET_TCP_WRITE_BUFFERS - uint32_t sndseq; -#endif + /* The next sequence number is equal to the current sequence * number (sndseq) plus the size of the outstanding, unacknowledged * data (tx_unacked). @@ -748,19 +746,24 @@ found: } #ifdef CONFIG_NET_TCP_WRITE_BUFFERS - /* Update sequence number to the unacknowledge sequence number. If - * there is still outstanding, unacknowledged data, then this will - * be beyond ackseq. - */ - - sndseq = tcp_getsequence(conn->sndseq); - if (TCP_SEQ_LT(sndseq, ackseq)) +#ifdef CONFIG_NET_SENDFILE + if (!conn->sendfile) +#endif { - ninfo("sndseq: %08" PRIx32 "->%08" PRIx32 - " unackseq: %08" PRIx32 " new tx_unacked: %" PRId32 "\n", - tcp_getsequence(conn->sndseq), ackseq, unackseq, - (uint32_t)conn->tx_unacked); - tcp_setsequence(conn->sndseq, ackseq); + /* Update sequence number to the unacknowledge sequence number. If + * there is still outstanding, unacknowledged data, then this will + * be beyond ackseq. + */ + + uint32_t sndseq = tcp_getsequence(conn->sndseq); + if (TCP_SEQ_LT(sndseq, ackseq)) + { + ninfo("sndseq: %08" PRIx32 "->%08" PRIx32 + " unackseq: %08" PRIx32 " new tx_unacked: %" PRIu32 "\n", + tcp_getsequence(conn->sndseq), ackseq, unackseq, + (uint32_t)conn->tx_unacked); + tcp_setsequence(conn->sndseq, ackseq); + } } #endif diff --git a/net/tcp/tcp_sendfile.c b/net/tcp/tcp_sendfile.c index 08d604ad63..e60aa88eb9 100644 --- a/net/tcp/tcp_sendfile.c +++ b/net/tcp/tcp_sendfile.c @@ -371,8 +371,6 @@ static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev, if ((pstate->snd_sent - pstate->snd_acked + sndlen) < conn->snd_wnd) { - uint32_t seqno; - /* Then set-up to send that amount of data. (this won't actually * happen until the polling cycle completes). */ @@ -396,20 +394,6 @@ static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev, dev->d_sndlen = sndlen; - /* Set the sequence number for this packet. NOTE: The network - * updates sndseq on recept of ACK *before* this function is - * called. In that case sndseq will point to the next - * unacknowledge byte (which might have already been sent). We - * will overwrite the value of sndseq here before the packet is - * sent. - */ - - seqno = pstate->snd_sent + pstate->snd_isn; - ninfo("SEND: sndseq %08" PRIx32 "->%08" PRIx32 " len: %d\n", - tcp_getsequence(conn->sndseq), seqno, ret); - - tcp_setsequence(conn->sndseq, seqno); - /* Notify the device driver of the availability of TX data */ sendfile_txnotify(psock, conn);