Browse Source

Check for no response in the listener thread and allow 1 minute timeouts for receiving messages

master
Con Kolivas 11 years ago
parent
commit
fefe13e929
  1. 5
      src/ckpool.c
  2. 4
      src/libckpool.c

5
src/ckpool.c

@ -45,6 +45,11 @@ retry:
}
/* Insert parsing and repeat code here */
buf = recv_unix_msg(sockd);
if (!buf) {
LOGWARNING("Failed to get message in listener");
close(sockd);
goto retry;
}
if (!strncasecmp(buf, "shutdown", 8)) {
LOGWARNING("Listener received shutdown message, terminating ckpool");
close(sockd);

4
src/libckpool.c

@ -701,7 +701,7 @@ out:
* string.*/
char *recv_unix_msg(int sockd)
{
tv_t tv_timeout = {1, 0};
tv_t tv_timeout = {60, 0};
char *buf = NULL;
uint32_t msglen;
fd_set readfs;
@ -729,7 +729,7 @@ char *recv_unix_msg(int sockd)
buf[msglen] = 0;
ofs = 0;
while (msglen) {
tv_timeout.tv_sec = 1;
tv_timeout.tv_sec = 60;
tv_timeout.tv_usec = 0;
FD_ZERO(&readfs);

Loading…
Cancel
Save