diff --git a/ChangeLog b/ChangeLog index c63b44110fa..356771d5328 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5777,4 +5777,7 @@ Sidrane (2013-10-16). * net/net_close.c: Changed net_close debug output to verbose. From 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). diff --git a/net/net_sendfile.c b/net/net_sendfile.c index 266bb5e08d4..7ec214b7448 100644 --- a/net/net_sendfile.c +++ b/net/net_sendfile.c @@ -152,6 +152,12 @@ static uint16_t ack_interrupt(FAR struct uip_driver_s *dev, FAR void *pvconn, 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 * 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 @@ -326,12 +332,6 @@ static uint16_t sendfile_interrupt(FAR struct uip_driver_s *dev, FAR void *pvcon pstate->snd_sent += sndlen; nllvdbg("pid: %d SEND: acked=%d sent=%d flen=%d\n", getpid(), 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 @@ -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) - else if (sendfile_timeout(pstate)) + if (sendfile_timeout(pstate)) { /* Yes.. report the timeout */ diff --git a/net/send.c b/net/send.c index d90b15b4041..4b6b34e7350 100644 --- a/net/send.c +++ b/net/send.c @@ -176,6 +176,12 @@ static uint16_t send_interrupt(FAR struct uip_driver_s *dev, FAR void *pvconn, 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 * 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 @@ -389,21 +395,15 @@ static uint16_t send_interrupt(FAR struct uip_driver_s *dev, FAR void *pvconn, pstate->snd_sent += sndlen; nllvdbg("SEND: acked=%d sent=%d buflen=%d\n", 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. */ #if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK) - else if (send_timeout(pstate)) + if (send_timeout(pstate)) { /* Yes.. report the timeout */