Check for no response in the listener thread and allow 1 minute timeouts for receiving messages
This commit is contained in:
parent
077825a09d
commit
fefe13e929
@ -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);
|
||||
|
||||
@ -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…
Reference in New Issue
Block a user