aboutsummaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-19 19:45:08 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-19 19:45:08 +0000
commit598b4b28793536198ffd145b895e2821334332da (patch)
tree7e6940dd2f5f0e829787a9606cd4b67001534acb /nuttx
parent1094575ce544860bc66b7c88d6b5eaf419d5ed7d (diff)
downloadpx4-firmware-598b4b28793536198ffd145b895e2821334332da.tar.gz
px4-firmware-598b4b28793536198ffd145b895e2821334332da.tar.bz2
px4-firmware-598b4b28793536198ffd145b895e2821334332da.zip
Minor tweak to last bugfix
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5540 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/net/recvfrom.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/nuttx/net/recvfrom.c b/nuttx/net/recvfrom.c
index 679b5e8ce..ac8065f81 100644
--- a/nuttx/net/recvfrom.c
+++ b/nuttx/net/recvfrom.c
@@ -563,12 +563,18 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn,
pstate->rf_cb->priv = NULL;
pstate->rf_cb->event = NULL;
- /* If the peer gracefully closed the connection, then return zero
- * (end-of-file). Otherwise, report a not-connected error
- * _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was
- * gracefully disconnected
- * _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was
- * rudely disconnected
+ /* Check if the peer gracefully closed the connection. We need
+ * these flags in case we return zero (below) to remember the
+ * state of the connection.
+ *
+ * _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was
+ * gracefully disconnected
+ * _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was
+ * rudely disconnected
+ *
+ * These flag settings are probably not necessary if
+ * CONFIG_NET_TCP_RECVDELAY == 0; in that case we know that
+ * pstate->rf_recvlen == 0 and we will always return -ENOTCONN.
*/
psock = pstate->rf_sock;
@@ -587,6 +593,7 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn,
* be reported the next time that recv[from]() is called.
*/
+#if CONFIG_NET_TCP_RECVDELAY > 0
if (pstate->rf_recvlen > 0)
{
pstate->rf_result = 0;
@@ -595,6 +602,9 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn,
{
pstate->rf_result = -ENOTCONN;
}
+#else
+ pstate->rf_result = -ENOTCONN;
+#endif
/* Wake up the waiting thread */