void XzeroHttpDaemon::onChild(ev::child&, int) { // the child exited before we receive a SUCCESS from it. so resume normal operation again. server_->log(x0::Severity::error, "New process exited with %d. Resuming normal operation."); child_.stop(); // reenable HUP-signal if (!hupSignal_.is_active()) { server_->log(x0::Severity::error, "Reenable HUP-signal."); hupSignal_.start(); ev_unref(loop_); } server_->log(x0::Severity::debug, "Reactivating listeners."); for (x0::ServerSocket* listener: server_->listeners()) { // reenable O_CLOEXEC on listener socket listener->setCloseOnExec(true); // start accepting new connections listener->start(); } server_->log(x0::Severity::debug, "Resuming workers."); for (x0::HttpWorker* worker: server_->workers()) { worker->resume(); } }
~MyServer() { if (sigterm_.is_active()) { ev_ref(loop_); sigterm_.stop(); } }