|
|
@ -29,10 +29,12 @@ static void *listener(void *arg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
proc_instance_t *pi = (proc_instance_t *)arg; |
|
|
|
proc_instance_t *pi = (proc_instance_t *)arg; |
|
|
|
unixsock_t *us = &pi->us; |
|
|
|
unixsock_t *us = &pi->us; |
|
|
|
|
|
|
|
char *buf = NULL; |
|
|
|
int sockd; |
|
|
|
int sockd; |
|
|
|
|
|
|
|
|
|
|
|
rename_proc(pi->sockname); |
|
|
|
rename_proc(pi->sockname); |
|
|
|
retry: |
|
|
|
retry: |
|
|
|
|
|
|
|
dealloc(buf); |
|
|
|
sockd = accept(us->sockd, NULL, NULL); |
|
|
|
sockd = accept(us->sockd, NULL, NULL); |
|
|
|
if (sockd < 0) { |
|
|
|
if (sockd < 0) { |
|
|
|
if (interrupted()) |
|
|
|
if (interrupted()) |
|
|
@ -41,9 +43,16 @@ retry: |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
/* Insert parsing and repeat code here */ |
|
|
|
/* Insert parsing and repeat code here */ |
|
|
|
out: |
|
|
|
buf = recv_unix_msg(sockd); |
|
|
|
if (sockd >= 0) |
|
|
|
if (!strncasecmp(buf, "shutdown", 8)) { |
|
|
|
|
|
|
|
LOGWARNING("Listener received shutdown message, terminating ckpool"); |
|
|
|
|
|
|
|
close(sockd); |
|
|
|
|
|
|
|
goto out; |
|
|
|
|
|
|
|
} |
|
|
|
close(sockd); |
|
|
|
close(sockd); |
|
|
|
|
|
|
|
goto retry; |
|
|
|
|
|
|
|
out: |
|
|
|
|
|
|
|
dealloc(buf); |
|
|
|
close_unix_socket(us->sockd, us->path); |
|
|
|
close_unix_socket(us->sockd, us->path); |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|