summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-10-17 09:19:03 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-10-17 09:19:03 -0600
commit3d66af833632324cd5dbae6344fef52011bc9896 (patch)
tree89ef628a56a1773811ece65d873eae83c34cd56b
parentb08dd365d6f335e76140691e5eb0f5ba59c7f9f4 (diff)
downloadnuttx-3d66af833632324cd5dbae6344fef52011bc9896.tar.gz
nuttx-3d66af833632324cd5dbae6344fef52011bc9896.tar.bz2
nuttx-3d66af833632324cd5dbae6344fef52011bc9896.zip
Reset TCP timeout timer when data is ACKed, not when data is sent. From Max Holtzberg
-rw-r--r--nuttx/ChangeLog3
-rw-r--r--nuttx/net/net_sendfile.c14
-rw-r--r--nuttx/net/send.c16
3 files changed, 18 insertions, 15 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index c63b44110..356771d53 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/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/nuttx/net/net_sendfile.c b/nuttx/net/net_sendfile.c
index 266bb5e08..7ec214b74 100644
--- a/nuttx/net/net_sendfile.c
+++ b/nuttx/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/nuttx/net/send.c b/nuttx/net/send.c
index d90b15b40..4b6b34e73 100644
--- a/nuttx/net/send.c
+++ b/nuttx/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 */