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

This commit is contained in:
Tatsuhiro Tsujikawa 2015-01-22 01:46:25 +09:00
parent 91ae5291cc
commit f604cbae70
1 changed files with 8 additions and 0 deletions

View File

@ -406,6 +406,10 @@ void graceful_shutdown_signal_cb(struct ev_loop *loop, ev_signal *w,
int revents) {
auto conn_handler = static_cast<ConnectionHandler *>(w->data);
if (worker_config->graceful_shutdown) {
return;
}
LOG(NOTICE) << "Graceful shutdown signal received";
worker_config->graceful_shutdown = true;
@ -419,6 +423,10 @@ void graceful_shutdown_signal_cb(struct ev_loop *loop, ev_signal *w,
conn_handler->graceful_shutdown_worker();
if (get_config()->num_worker == 1) {
return;
}
// We have accepted all pending connections. Shutdown main event
// loop.
ev_break(loop);