summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-02 20:36:10 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-02 20:36:10 +0000
commita376ebf2a0c8b3b2d50eeb6be645311eb27579dd (patch)
tree940328f14fedaf85cdc331697b774c4855320de3 /nuttx
parentad7aa52a9dcb837bfaf35dbbe76fee36cb9928e5 (diff)
downloadpx4-nuttx-a376ebf2a0c8b3b2d50eeb6be645311eb27579dd.tar.gz
px4-nuttx-a376ebf2a0c8b3b2d50eeb6be645311eb27579dd.tar.bz2
px4-nuttx-a376ebf2a0c8b3b2d50eeb6be645311eb27579dd.zip
Fix timeout setup
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@867 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/net/send.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/nuttx/net/send.c b/nuttx/net/send.c
index 14b9dc8cf..74a96f7f8 100644
--- a/nuttx/net/send.c
+++ b/nuttx/net/send.c
@@ -48,6 +48,7 @@
#include <debug.h>
#include <arch/irq.h>
+#include <nuttx/clock.h>
#include <net/uip/uip-arch.h>
#include "net-internal.h"
@@ -222,7 +223,7 @@ static uint16 send_interrupt(struct uip_driver_s *dev, void *pvconn,
if ( pstate->snd_acked >= pstate->snd_buflen)
{
- /* Yes. Then pstate->snd_len should hold the number of bytes
+ /* Yes. Then pstate->snd_buflen should hold the number of bytes
* actually sent.
*/
@@ -272,10 +273,12 @@ static uint16 send_interrupt(struct uip_driver_s *dev, void *pvconn,
/* We get here if (1) not all of the data has been ACKed, (2) we have been
* asked to retransmit data, (3) the connection is still healthy, and (4)
* the outgoing packet is available for our use. In this case, we are
- * now free to send more data to receiver.
+ * now free to send more data to receiver -- UNLESS the buffer contains
+ * unprocessing incoming data. In that event, we will have to wait for the
+ * next polling cycle.
*/
- if (pstate->snd_sent < pstate->snd_buflen)
+ if ((flags & UIP_NEWDATA) == 0 && pstate->snd_sent < pstate->snd_buflen)
{
/* Get the amount of data that we can send in the next packet */
@@ -294,6 +297,12 @@ static uint16 send_interrupt(struct uip_driver_s *dev, void *pvconn,
pstate->snd_sent += sndlen;
nvdbg("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 = g_system_timer;
+#endif
}
/* All data has been send and we are just waiting for ACK or re-tranmist
@@ -449,8 +458,13 @@ ssize_t send(int sockfd, const void *buf, size_t len, int flags)
{
/* Get the initial sequence number that will be used */
- state.snd_isn = send_getisn(conn); /* Initial sequence number */
+ state.snd_isn = send_getisn(conn); /* Initial sequence number */
+ /* Update the initial time for calculating timeouts */
+
+#if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
+ state.snd_time = g_system_timer;
+#endif
/* Set up the callback in the connection */
state.snd_cb->flags = UIP_ACKDATA|UIP_REXMIT|UIP_POLL|UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT;