jobserver: use non-blocking accept
To allow the JobServer to shutdown properly, the accept() loop in JobServer::run() needs to regularly check whether we're done. This change introduces a timed, non-blocking variant of accept() into SocketComm to achieve this. Change-Id: Id411096be816c4ed6c7b0b37674410e22152eb22
This commit is contained in:
@ -45,6 +45,16 @@ public:
|
||||
*/
|
||||
static bool dropMsg(int sockfd);
|
||||
|
||||
/**
|
||||
* An accept() wrapper that times out (using poll(2))
|
||||
* @param sockfd listening socket descriptor to accept connections from
|
||||
* @param addr same as accept()'s
|
||||
* @param addrlen same as accept()'s
|
||||
* @param timeout timeout in milliseconds (see poll(2))
|
||||
* \return < 0 on failure, > 0 for a new socket connection
|
||||
*/
|
||||
static int timedAccept(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int timeout);
|
||||
|
||||
private:
|
||||
static char * getBuf(int sockfd, int *size);
|
||||
static ssize_t safe_write(int fd, const void *buf, size_t count);
|
||||
|
||||
Reference in New Issue
Block a user