Log when SIG{TERM,USR1} is received ASAP MP-513
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 17 Feb 2014 09:46:39 +0000 (10:46 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 17 Feb 2014 09:46:39 +0000 (10:46 +0100)
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
src/metaproxy_prog.cpp

index 0fef9e6..a1e1c01 100644 (file)
@@ -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)
             {
index 58629d3..481901b 100644 (file)
@@ -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;