Commit f604cbae authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Fix shutdown too early with QUIT signal if num_worker == 1

parent 91ae5291
...@@ -406,6 +406,10 @@ void graceful_shutdown_signal_cb(struct ev_loop *loop, ev_signal *w, ...@@ -406,6 +406,10 @@ void graceful_shutdown_signal_cb(struct ev_loop *loop, ev_signal *w,
int revents) { int revents) {
auto conn_handler = static_cast<ConnectionHandler *>(w->data); auto conn_handler = static_cast<ConnectionHandler *>(w->data);
if (worker_config->graceful_shutdown) {
return;
}
LOG(NOTICE) << "Graceful shutdown signal received"; LOG(NOTICE) << "Graceful shutdown signal received";
worker_config->graceful_shutdown = true; worker_config->graceful_shutdown = true;
...@@ -419,6 +423,10 @@ void graceful_shutdown_signal_cb(struct ev_loop *loop, ev_signal *w, ...@@ -419,6 +423,10 @@ void graceful_shutdown_signal_cb(struct ev_loop *loop, ev_signal *w,
conn_handler->graceful_shutdown_worker(); conn_handler->graceful_shutdown_worker();
if (get_config()->num_worker == 1) {
return;
}
// We have accepted all pending connections. Shutdown main event // We have accepted all pending connections. Shutdown main event
// loop. // loop.
ev_break(loop); ev_break(loop);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment