|
|
@ -784,7 +784,7 @@ int process_exit(ckpool_t *ckp, proc_instance_t *pi, int ret) |
|
|
|
LOGWARNING("%s %s exiting with return code %d, shutting down!", |
|
|
|
LOGWARNING("%s %s exiting with return code %d, shutting down!", |
|
|
|
ckp->name, pi->processname, ret); |
|
|
|
ckp->name, pi->processname, ret); |
|
|
|
send_proc(&ckp->main, "shutdown"); |
|
|
|
send_proc(&ckp->main, "shutdown"); |
|
|
|
sleep(1); |
|
|
|
cksleep_ms(100); |
|
|
|
ret = 1; |
|
|
|
ret = 1; |
|
|
|
} else /* Should be part of a normal shutdown */ |
|
|
|
} else /* Should be part of a normal shutdown */ |
|
|
|
LOGNOTICE("%s %s exited normally", ckp->name, pi->processname); |
|
|
|
LOGNOTICE("%s %s exited normally", ckp->name, pi->processname); |
|
|
@ -856,8 +856,8 @@ static void sighandler(int sig) |
|
|
|
cancel_join_pthread(&ckp->pth_watchdog); |
|
|
|
cancel_join_pthread(&ckp->pth_watchdog); |
|
|
|
|
|
|
|
|
|
|
|
__shutdown_children(ckp, SIGUSR1); |
|
|
|
__shutdown_children(ckp, SIGUSR1); |
|
|
|
/* Wait a second, then send SIGKILL */ |
|
|
|
/* Wait, then send SIGKILL */ |
|
|
|
sleep(1); |
|
|
|
cksleep_ms(100); |
|
|
|
__shutdown_children(ckp, SIGKILL); |
|
|
|
__shutdown_children(ckp, SIGKILL); |
|
|
|
cancel_pthread(&ckp->pth_listener); |
|
|
|
cancel_pthread(&ckp->pth_listener); |
|
|
|
exit(0); |
|
|
|
exit(0); |
|
|
@ -1106,6 +1106,18 @@ static struct option long_options[] = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void send_recv_path(const char *path, const char *msg) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int sockd = open_unix_client(path); |
|
|
|
|
|
|
|
char *response; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
send_unix_msg(sockd, msg); |
|
|
|
|
|
|
|
response = recv_unix_msg(sockd); |
|
|
|
|
|
|
|
LOGWARNING("Received: %s in response to %s request", response, msg); |
|
|
|
|
|
|
|
dealloc(response); |
|
|
|
|
|
|
|
Close(sockd); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv) |
|
|
|
int main(int argc, char **argv) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct sigaction handler; |
|
|
|
struct sigaction handler; |
|
|
@ -1324,13 +1336,15 @@ int main(int argc, char **argv) |
|
|
|
|
|
|
|
|
|
|
|
if (sockd > 0 && send_unix_msg(sockd, "getfd")) { |
|
|
|
if (sockd > 0 && send_unix_msg(sockd, "getfd")) { |
|
|
|
ckp.oldconnfd = get_fd(sockd); |
|
|
|
ckp.oldconnfd = get_fd(sockd); |
|
|
|
|
|
|
|
|
|
|
|
Close(sockd); |
|
|
|
Close(sockd); |
|
|
|
sockd = open_unix_client(ckp.main.us.path); |
|
|
|
|
|
|
|
send_unix_msg(sockd, "shutdown"); |
|
|
|
send_recv_path(ckp.main.us.path, "reject"); |
|
|
|
|
|
|
|
send_recv_path(ckp.main.us.path, "reconnect"); |
|
|
|
|
|
|
|
send_recv_path(ckp.main.us.path, "shutdown"); |
|
|
|
|
|
|
|
cksleep_ms(500); |
|
|
|
|
|
|
|
|
|
|
|
if (ckp.oldconnfd > 0) |
|
|
|
if (ckp.oldconnfd > 0) |
|
|
|
LOGWARNING("Inherited old socket with new file descriptor %d!", ckp.oldconnfd); |
|
|
|
LOGWARNING("Inherited old socket with new file descriptor %d!", ckp.oldconnfd); |
|
|
|
Close(sockd); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|