diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-19 19:45:08 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-19 19:45:08 +0000 |
commit | 097833173cfac12be60593a000e8d737c46ac428 (patch) | |
tree | 7e6940dd2f5f0e829787a9606cd4b67001534acb | |
parent | 0d20be167a79f6d8bf80af8d724279ff21a5f529 (diff) | |
download | px4-nuttx-097833173cfac12be60593a000e8d737c46ac428.tar.gz px4-nuttx-097833173cfac12be60593a000e8d737c46ac428.tar.bz2 px4-nuttx-097833173cfac12be60593a000e8d737c46ac428.zip |
Minor tweak to last bugfix
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5540 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | nuttx/net/recvfrom.c | 22 |
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 */ |