diff options
author | dimitri staessens <[email protected]> | 2017-08-15 19:30:03 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-08-16 08:18:03 +0200 |
commit | c995538b1c6483996c979df62feee3d79acd0e45 (patch) | |
tree | 67fb33f13b02be7b9b65b47957ce5065ebb97411 /src/ipcpd/ipcp.h | |
parent | 095c2414425952836e97d88a6dde6f4415725c68 (diff) | |
download | ouroboros-c995538b1c6483996c979df62feee3d79acd0e45.tar.gz ouroboros-c995538b1c6483996c979df62feee3d79acd0e45.zip |
irmd, ipcpd: Listen on a dedicated accept() thread
The IRMd and IPCPs will now call accept on their command sockets from
a single thread that will dispatch work to the other threads.
This solves a problem on OS X and FreeBSD where accept() doesn't time
out when setting SO_RCVTIMEO on the socket. Calling kqueue or select()
on that socket to wait for events before calling accept() didn't solve
it since select() or kqueue() might wake up multiple threads, with the
non-working threads again blocked on the accept() on shutdown.
Diffstat (limited to 'src/ipcpd/ipcp.h')
-rw-r--r-- | src/ipcpd/ipcp.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h index 9ce3ed77..d2ad7cde 100644 --- a/src/ipcpd/ipcp.h +++ b/src/ipcpd/ipcp.h @@ -26,6 +26,7 @@ #include <ouroboros/config.h> #include <ouroboros/hash.h> #include <ouroboros/ipcp.h> +#include <ouroboros/sockets.h> #include "shim-data.h" @@ -89,10 +90,17 @@ struct ipcp { int sockfd; char * sock_path; + uint8_t cbuf[IPCP_MSG_BUF_SIZE]; + size_t cmd_len; + int csockfd; + pthread_cond_t cmd_cond; + pthread_mutex_t cmd_lock; + int alloc_id; pthread_cond_t alloc_cond; pthread_mutex_t alloc_lock; + pthread_t acceptor; } ipcpi; int ipcp_init(int argc, |