Minor tweak to last bugfix

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5540 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2013-01-19 19:45:08 +00:00
parent 4e7340ab13
commit 00082e0da7
1 changed files with 16 additions and 6 deletions

View File

@ -563,12 +563,18 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn,
pstate->rf_cb->priv = NULL; pstate->rf_cb->priv = NULL;
pstate->rf_cb->event = NULL; pstate->rf_cb->event = NULL;
/* If the peer gracefully closed the connection, then return zero /* Check if the peer gracefully closed the connection. We need
* (end-of-file). Otherwise, report a not-connected error * these flags in case we return zero (below) to remember the
* _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was * state of the connection.
* gracefully disconnected *
* _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was * _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was
* rudely disconnected * 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; 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. * be reported the next time that recv[from]() is called.
*/ */
#if CONFIG_NET_TCP_RECVDELAY > 0
if (pstate->rf_recvlen > 0) if (pstate->rf_recvlen > 0)
{ {
pstate->rf_result = 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; pstate->rf_result = -ENOTCONN;
} }
#else
pstate->rf_result = -ENOTCONN;
#endif
/* Wake up the waiting thread */ /* Wake up the waiting thread */