diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-12-08 16:55:24 +0100 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-12-08 17:14:36 +0100 |
commit | 12935222221e316d188075602f07c372e00c855e (patch) | |
tree | e2cc741142545bf8469d0e550b2b36ca0fc64025 /src/irmd | |
parent | 82ae7959d21c654fe9fd14de504f47d18b1ebcfc (diff) | |
download | ouroboros-12935222221e316d188075602f07c372e00c855e.tar.gz ouroboros-12935222221e316d188075602f07c372e00c855e.zip |
irmd, ipcp: Call select on FreeBSD
*BSD accept() doesn't timeout on the timeval set by setsockopt
SO_RCVTIMEO. The irmd and ipcp will now call select on the irmd fd
with the same timeout.
Diffstat (limited to 'src/irmd')
-rw-r--r-- | src/irmd/main.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c index d8cb27fa..dc0c26f2 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -1804,6 +1804,11 @@ void * mainloop(void * o) (void) o; while (true) { +#ifdef __FreeBSD__ + fd_set fds; + struct timeval timeout = {(IRMD_ACCEPT_TIMEOUT / 1000), + (IRMD_ACCEPT_TIMEOUT % 1000) * 1000}; +#endif int cli_sockfd; irm_msg_t * msg; ssize_t count; @@ -1822,7 +1827,12 @@ void * mainloop(void * o) pthread_rwlock_unlock(&irmd->state_lock); ret_msg.code = IRM_MSG_CODE__IRM_REPLY; - +#ifdef __FreeBSD__ + FD_ZERO(&fds); + FD_SET(irmd->sockfd, &fds); + if (select(irmd->sockfd, &fds, NULL, NULL, &timeout) <= 0) + continue; +#endif cli_sockfd = accept(irmd->sockfd, 0, 0); if (cli_sockfd < 0) continue; |