From: Adam Dickmeiss Date: Mon, 17 Feb 2014 09:46:39 +0000 (+0100) Subject: Log when SIG{TERM,USR1} is received ASAP MP-513 X-Git-Tag: v1.4.4~1 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=54830ce98edada799c4a6fd2968331e955068ba2;p=metaproxy-moved-to-github.git Log when SIG{TERM,USR1} is received ASAP MP-513 Do it in frontend_net event loop rather than in place for metaproxy main, which only exits when all sessions are terminated for SIGUSR1 at graceful stop. --- diff --git a/src/filter_frontend_net.cpp b/src/filter_frontend_net.cpp index 0fef9e6..a1e1c01 100644 --- a/src/filter_frontend_net.cpp +++ b/src/filter_frontend_net.cpp @@ -594,9 +594,13 @@ void yf::FrontendNet::process(mp::Package &package) const while (m_p->mySocketManager.processEvent() > 0) { if (m_p->m_stop_signo == SIGTERM) + { + yaz_log(YLOG_LOG, "metaproxy received SIGTERM"); break; /* stop right away */ + } if (m_p->m_stop_signo == SIGUSR1) { /* just stop listeners and cont till all sessions are done*/ + yaz_log(YLOG_LOG, "metaproxy received SIGUSR1"); m_p->m_stop_signo = 0; if (m_p->az) { diff --git a/src/metaproxy_prog.cpp b/src/metaproxy_prog.cpp index 58629d3..481901b 100644 --- a/src/metaproxy_prog.cpp +++ b/src/metaproxy_prog.cpp @@ -91,21 +91,6 @@ static void work_common(void *data) mp::Package pack; pack.router(*routerp).move(); -#if HAVE_UNISTD_H - switch (sig_received) - { - case SIGTERM: - yaz_log(YLOG_LOG, "metaproxy received SIGTERM"); - break; - case SIGUSR1: - yaz_log(YLOG_LOG, "metaproxy received SIGUSR1"); - break; - case 0: - break; - default: - yaz_log(YLOG_LOG, "metaproxy received signo=%d", sig_received); - } -#endif yaz_log(YLOG_LOG, "metaproxy stop"); delete routerp; routerp = 0;