diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-09-08 22:41:00 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-09-08 22:41:00 +0000 |
commit | 712b9f5349a81fe56fa060ccb8aa13e0db830657 (patch) | |
tree | dfbb89ff177cb40a24945fa3925c9e75230a6a5b /nuttx/net/recvfrom.c | |
parent | 255e1fe83691a2c5a3328bcec13e2bce0a140696 (diff) | |
download | px4-nuttx-712b9f5349a81fe56fa060ccb8aa13e0db830657.tar.gz px4-nuttx-712b9f5349a81fe56fa060ccb8aa13e0db830657.tar.bz2 px4-nuttx-712b9f5349a81fe56fa060ccb8aa13e0db830657.zip |
Cleanup and fix problems introduce in last commit
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@337 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/recvfrom.c')
-rw-r--r-- | nuttx/net/recvfrom.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/nuttx/net/recvfrom.c b/nuttx/net/recvfrom.c index d008262bf..d4a1898c9 100644 --- a/nuttx/net/recvfrom.c +++ b/nuttx/net/recvfrom.c @@ -59,7 +59,7 @@ struct recvfrom_s { #if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK) - FAR struct socket *rf_sock /* The parent socket structure */ + FAR struct socket *rf_sock; /* The parent socket structure */ #endif sem_t rf_sem; /* Semaphore signals recv completion */ sint16 rf_buflen; /* Length of receive buffer (error if <0) */ @@ -102,7 +102,7 @@ void recvfrom_interrupt(void *private) /* Don't allow any further call backs. */ - uip_conn->private = NULL; + uip_conn->private = NULL; uip_conn->callback = NULL; /* Wake up the waiting thread, returning the number of bytes @@ -113,23 +113,33 @@ void recvfrom_interrupt(void *private) sem_post(&pstate-> rf_sem); } - /* No data has been received. If this is a poll event, then check - * for a timeout. + /* No data has been received -- this is some other event... probably a + * poll -- check for a timeout. */ #if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK) - else if (uip_newdata() && pstate->rf_sock) + else if (pstate->rf_sock) { /* Check if SO_RCVTIMEO has been selected for this socket */ - uint rcvtimeo = ; if (pstate->rf_sock->s_rcvtimeo) { /* Yes.. Check if the timeout has elapsed */ if (net_timeo(pstate->rf_starttime, pstate->rf_sock->s_rcvtimeo)) { - } + /* Don't allow any further call backs. */ + + uip_conn->private = NULL; + uip_conn->callback = NULL; + + /* Wake up the waiting thread, returning the error -EAGAIN + * that signals the timeout event + */ + + pstate->rf_buflen = -EAGAIN; + sem_post(&pstate-> rf_sem); + } } } #endif |