From 54830ce98edada799c4a6fd2968331e955068ba2 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 17 Feb 2014 10:46:39 +0100 Subject: [PATCH] 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. --- src/filter_frontend_net.cpp | 4 ++++ src/metaproxy_prog.cpp | 15 --------------- 2 files changed, 4 insertions(+), 15 deletions(-) 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; -- 1.7.10.4