diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-09-08 21:54:43 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-09-08 21:54:43 +0000 |
commit | 255e1fe83691a2c5a3328bcec13e2bce0a140696 (patch) | |
tree | 9868873a70e46df85e9ec0cf7c599239808b8808 /nuttx/net/uip | |
parent | b084f0f30622b823a1cb99324505aaca673ccef1 (diff) | |
download | px4-nuttx-255e1fe83691a2c5a3328bcec13e2bce0a140696.tar.gz px4-nuttx-255e1fe83691a2c5a3328bcec13e2bce0a140696.tar.bz2 px4-nuttx-255e1fe83691a2c5a3328bcec13e2bce0a140696.zip |
Added receive timeout via setsockopt(SO_RCVTIMEO)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@336 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/uip')
-rw-r--r-- | nuttx/net/uip/uip-wait.c | 55 |
1 files changed, 3 insertions, 52 deletions
diff --git a/nuttx/net/uip/uip-wait.c b/nuttx/net/uip/uip-wait.c index c7bf0a1bb..14775f54e 100644 --- a/nuttx/net/uip/uip-wait.c +++ b/nuttx/net/uip/uip-wait.c @@ -39,7 +39,6 @@ #include <nuttx/config.h> #include <semaphore.h> -#include <wdog.h> #include <arch/irq.h> #include <net/uip/uip.h> @@ -63,31 +62,18 @@ static uint16 uip_waitflags = 0; /* UIP flags to wait for */ * Private Functions ************************************************************/ -/* Called from the timer interrupt handler when a event wait - * watchdog expires. - */ - -static void uip_event_timeout(int argc, uint32 itcb, ...) -{ - irqstate_t save = irqsave(); /* Should not be necessary */ - uip_flags |= UIP_APPTIMEOUT; /* Set software timeout event */ - uip_event_signal(); /* Signal the waiting thread/task */ - irqrestore(save); /* Restore interrupts */ -} - /************************************************************ * Global Functions ************************************************************/ /* This function is called user code to set up the wait */ -int uip_event_timedwait(uint16 waitflags, int timeout) +int uip_event_wait(uint16 waitflags) { /* Prevent conflicts with the interrupt level operation of * uip_event_signal(). */ irqstate_t save = irqsave(); - WDOG_ID wdog; /* At present, we support only a single waiter. If uip_waitflags * is non-zero on entry, then there is a problem. @@ -111,52 +97,17 @@ int uip_event_timedwait(uint16 waitflags, int timeout) uip_waitflags = waitflags; - /* Was a timeut requested as well? */ - - if (timeout) - { - /* Yes, then set the application timeout event as well */ - - uip_waitflags |= UIP_APPTIMEOUT; - - /* Create a watchdog */ - - wdog = wd_create(); - if (!wdog) - { - goto errout_with_irqdisabled; - } - - /* Start the watchdog */ - - wd_start(wdog, timeout, (wdentry_t)uip_event_timeout, 0); - } - - /* Wait for the event (or timeout) to occur */ + /* Wait for the event to occur */ if (sem_wait(&uip_waitsem) != 0) { - goto errout_with_watchdog; - } - - /* We no longer need the watchdog */ - - if (wdog) - { - wd_delete(wdog); - wdog = NULL; + goto errout_with_irqdisabled; } } irqrestore(save); return OK; -errout_with_watchdog: - if (wdog) - { - wd_delete(wdog); - } - errout_with_irqdisabled: irqrestore(save); return ERROR; |