diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-12-07 17:42:52 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-12-07 17:42:52 +0000 |
commit | 91b1c8e69e8b047c62cd301ebf6f4b8627941c08 (patch) | |
tree | 7e836dcb925324762fdd9825fbc22ec3cb46003a /cpukit/libnetworking/rtems/rtems_glue.c | |
parent | changed version to 19981203 (diff) | |
download | rtems-91b1c8e69e8b047c62cd301ebf6f4b8627941c08.tar.bz2 |
Patch from Ian Lance Taylor <ian@airs.com>:
RTEMS permits using the SO_SNDTIMEO and SO_RCVTIMEO socket options to
set a timeout for most socket I/O operations. However, in RTEMS
4.0.0, those options do not affect connect or accept. I don't know of
any way to put a timeout on those calls in RTEMS 4.0.0; can anybody
point to one.
Since it is frequently useful to have a timeout on accept, and
sometimes useful to have a timeout on connect shorter than the BSD
system default of 75 seconds, the following patch causes SO_RCVTIMEO
to affect connect and accept.
Diffstat (limited to 'cpukit/libnetworking/rtems/rtems_glue.c')
-rw-r--r-- | cpukit/libnetworking/rtems/rtems_glue.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cpukit/libnetworking/rtems/rtems_glue.c b/cpukit/libnetworking/rtems/rtems_glue.c index aea0a548b2..f2449831f5 100644 --- a/cpukit/libnetworking/rtems/rtems_glue.c +++ b/cpukit/libnetworking/rtems/rtems_glue.c @@ -380,11 +380,12 @@ wakeup (void *p) /* * Wait for a connection/disconnection event. */ -void +int soconnsleep (struct socket *so) { rtems_event_set events; rtems_id tid; + rtems_status_code sc; /* * Soak up any pending events. @@ -404,12 +405,18 @@ soconnsleep (struct socket *so) /* * Wait for the wakeup event. */ - rtems_bsdnet_event_receive (SOSLEEP_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events); + sc = rtems_bsdnet_event_receive (SOSLEEP_EVENT, RTEMS_EVENT_ANY | RTEMS_WAIT, so->so_rcv.sb_timeo, &events); /* * Relinquish ownership of the socket. */ so->so_pgid = 0; + + switch (sc) { + case RTEMS_SUCCESSFUL: return 0; + case RTEMS_TIMEOUT: return EWOULDBLOCK; + default: return ENXIO; + } } /* |