mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-08 06:31:58 +00:00
allows sub-emperors (emperors generated by emperors)
This commit is contained in:
@@ -328,7 +328,12 @@ void emperor_loop() {
|
||||
|
||||
events = event_queue_alloc(64);
|
||||
|
||||
uwsgi_log("*** starting uWSGI Emperor ***\n");
|
||||
if (uwsgi.has_emperor) {
|
||||
uwsgi_log("*** starting uWSGI sub-Emperor ***\n");
|
||||
}
|
||||
else {
|
||||
uwsgi_log("*** starting uWSGI Emperor ***\n");
|
||||
}
|
||||
|
||||
amqp_port = strchr(uwsgi.emperor_dir, ':');
|
||||
|
||||
@@ -356,7 +361,7 @@ reconnect:
|
||||
event_queue_add_fd_read(emperor_queue, amqp_fd);
|
||||
}
|
||||
else {
|
||||
if (!glob(uwsgi.emperor_dir, GLOB_MARK, NULL, &g)) {
|
||||
if (!glob(uwsgi.emperor_dir, GLOB_MARK|GLOB_NOCHECK, NULL, &g)) {
|
||||
if (g.gl_pathc == 1 && g.gl_pathv[0][strlen(g.gl_pathv[0]) - 1] == '/') {
|
||||
simple_mode = 1;
|
||||
if (chdir(uwsgi.emperor_dir)) {
|
||||
@@ -531,7 +536,7 @@ reconnect:
|
||||
closedir(dir);
|
||||
}
|
||||
else {
|
||||
if (glob(uwsgi.emperor_dir, GLOB_MARK, NULL, &g)) {
|
||||
if (glob(uwsgi.emperor_dir, GLOB_MARK|GLOB_NOCHECK, NULL, &g)) {
|
||||
uwsgi_error("glob()");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -422,6 +422,7 @@ void kill_them_all(int signum) {
|
||||
|
||||
if (uwsgi.emperor_pid >= 0) {
|
||||
kill(uwsgi.emperor_pid, SIGKILL);
|
||||
waitpid(uwsgi.emperor_pid, &i, 0);
|
||||
uwsgi_log( "killed the emperor with pid %d\n", uwsgi.emperor_pid);
|
||||
}
|
||||
|
||||
@@ -456,6 +457,7 @@ void grace_them_all(int signum) {
|
||||
|
||||
if (uwsgi.emperor_pid >= 0) {
|
||||
kill(uwsgi.emperor_pid, SIGKILL);
|
||||
waitpid(uwsgi.emperor_pid, &i, 0);
|
||||
uwsgi_log( "killed the emperor with pid %d\n", uwsgi.emperor_pid);
|
||||
}
|
||||
|
||||
@@ -529,6 +531,12 @@ void reap_them_all(int signum) {
|
||||
kill(uwsgi.gateways[i].pid, SIGKILL);
|
||||
}
|
||||
|
||||
if (uwsgi.emperor_pid >= 0) {
|
||||
kill(uwsgi.emperor_pid, SIGKILL);
|
||||
waitpid(uwsgi.emperor_pid, &i, 0);
|
||||
uwsgi_log( "killed the emperor with pid %d\n", uwsgi.emperor_pid);
|
||||
}
|
||||
|
||||
if (!uwsgi.workers)
|
||||
return;
|
||||
|
||||
@@ -1357,6 +1365,11 @@ int uwsgi_start(void *v_argv) {
|
||||
exit(1);
|
||||
}
|
||||
else if (uwsgi.emperor_pid == 0) {
|
||||
#ifdef __linux__
|
||||
if (prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0)) {
|
||||
uwsgi_error("prctl()");
|
||||
}
|
||||
#endif
|
||||
emperor_loop();
|
||||
// never here
|
||||
exit(1);
|
||||
@@ -1743,7 +1756,7 @@ int uwsgi_start(void *v_argv) {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!uwsgi.sockets && !uwsgi.gateways_cnt && !uwsgi.no_server && !uwsgi.udp_socket) {
|
||||
if (!uwsgi.sockets && !uwsgi.gateways_cnt && !uwsgi.no_server && !uwsgi.udp_socket && !uwsgi.emperor_dir) {
|
||||
uwsgi_log("The -s/--socket option is missing and stdin is not a socket.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user