void sig_handlers::sig_term (ev::sig &w, int revents) { rxvt_emergency_cleanup (); w.stop (); kill (getpid (), w.signum); }
~MyServer() { if (sigterm_.is_active()) { ev_ref(loop_); sigterm_.stop(); } }
void terminate_handler(ev::sig& sig, int) { std::clog << "Terminate signal received ..." << std::endl; ev_ref(loop_); sig.stop(); http_->stop(); }
// stage-2 termination handler void XzeroHttpDaemon::quickShutdownHandler(ev::sig& sig, int) { log(x0::Severity::info, "%s received. shutting down NOW.", sig2str(sig.signum).c_str()); if (!child_.pid) { // we are no garbage parent process sd_notify(0, "STATUS=Shutting down."); } // default to standard signal-handler ev_ref(loop_); sig.stop(); // install shutdown timeout handler terminationTimeout_.set<XzeroHttpDaemon, &XzeroHttpDaemon::quickShutdownTimeout>(this); terminationTimeout_.start(10, 0); ev_unref(loop_); // kill active HTTP connections server_->kill(); }