Reset TCP timeout timer when data is ACKed, not when data is sent. From Max Holtzberg

This commit is contained in:
Gregory Nutt 2013-10-17 09:19:03 -06:00
parent 408ff55b7e
commit bf5ae4a374
3 changed files with 18 additions and 15 deletions

View File

@ -5777,4 +5777,7 @@
Sidrane (2013-10-16). Sidrane (2013-10-16).
* net/net_close.c: Changed net_close debug output to verbose. From * net/net_close.c: Changed net_close debug output to verbose. From
Max Holtzberg (2013-10-17). Max Holtzberg (2013-10-17).
* net/send.c and net_sendfile.c: Reset the send timeout when the
data is ACKed, not when the data is sent. Remove concitions on
checking for timeout. From Max Holtzberg (2013-10-17).

View File

@ -152,6 +152,12 @@ static uint16_t ack_interrupt(FAR struct uip_driver_s *dev, FAR void *pvconn,
if ((flags & UIP_ACKDATA) != 0) if ((flags & UIP_ACKDATA) != 0)
{ {
/* Update the timeout */
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
pstate->snd_time = clock_systimer();
#endif
/* The current acknowledgement number number is the (relative) offset /* The current acknowledgement number number is the (relative) offset
* of the of the next byte needed by the receiver. The snd_isn is the * of the of the next byte needed by the receiver. The snd_isn is the
* offset of the first byte to send to the receiver. The difference * offset of the first byte to send to the receiver. The difference
@ -326,12 +332,6 @@ static uint16_t sendfile_interrupt(FAR struct uip_driver_s *dev, FAR void *pvcon
pstate->snd_sent += sndlen; pstate->snd_sent += sndlen;
nllvdbg("pid: %d SEND: acked=%d sent=%d flen=%d\n", getpid(), nllvdbg("pid: %d SEND: acked=%d sent=%d flen=%d\n", getpid(),
pstate->snd_acked, pstate->snd_sent, pstate->snd_flen); pstate->snd_acked, pstate->snd_sent, pstate->snd_flen);
/* Update the send time */
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
pstate->snd_time = clock_systimer();
#endif
} }
} }
else else
@ -346,7 +346,7 @@ static uint16_t sendfile_interrupt(FAR struct uip_driver_s *dev, FAR void *pvcon
*/ */
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK) #if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
else if (sendfile_timeout(pstate)) if (sendfile_timeout(pstate))
{ {
/* Yes.. report the timeout */ /* Yes.. report the timeout */

View File

@ -176,6 +176,12 @@ static uint16_t send_interrupt(FAR struct uip_driver_s *dev, FAR void *pvconn,
if ((flags & UIP_ACKDATA) != 0) if ((flags & UIP_ACKDATA) != 0)
{ {
/* Update the timeout */
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
pstate->snd_time = clock_systimer();
#endif
/* The current acknowledgement number number is the (relative) offset /* The current acknowledgement number number is the (relative) offset
* of the of the next byte needed by the receiver. The snd_isn is the * of the of the next byte needed by the receiver. The snd_isn is the
* offset of the first byte to send to the receiver. The difference * offset of the first byte to send to the receiver. The difference
@ -389,21 +395,15 @@ static uint16_t send_interrupt(FAR struct uip_driver_s *dev, FAR void *pvconn,
pstate->snd_sent += sndlen; pstate->snd_sent += sndlen;
nllvdbg("SEND: acked=%d sent=%d buflen=%d\n", nllvdbg("SEND: acked=%d sent=%d buflen=%d\n",
pstate->snd_acked, pstate->snd_sent, pstate->snd_buflen); pstate->snd_acked, pstate->snd_sent, pstate->snd_buflen);
/* Update the send time */
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
pstate->snd_time = clock_systimer();
#endif
} }
} }
/* All data has been send and we are just waiting for ACK or re-transmit /* All data has been sent and we are just waiting for ACK or re-transmit
* indications to complete the send. Check for a timeout. * indications to complete the send. Check for a timeout.
*/ */
#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK) #if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
else if (send_timeout(pstate)) if (send_timeout(pstate))
{ {
/* Yes.. report the timeout */ /* Yes.. report the timeout */