From 4c528bfa11ac8640b5bf8f7018d0d096d30081df Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 9 May 2012 12:23:47 +0200 Subject: [PATCH] Use yaz_daemon_stop for graceful stop --- src/metaproxy_prog.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/metaproxy_prog.cpp b/src/metaproxy_prog.cpp index 02f197f..6ecc5f0 100644 --- a/src/metaproxy_prog.cpp +++ b/src/metaproxy_prog.cpp @@ -54,6 +54,7 @@ static void sig_usr1_handler(int s) { yaz_log(YLOG_LOG, "metaproxy received SIGUSR1"); routerp->stop(); + yaz_daemon_stop(); } static void sig_term_handler(int s) @@ -69,7 +70,7 @@ static void work_common(void *data) { #if HAVE_UNISTD_H process_group = getpgid(0); // save process group ID - + signal(SIGTERM, sig_term_handler); signal(SIGUSR1, sig_usr1_handler); #endif @@ -78,9 +79,7 @@ static void work_common(void *data) mp::Package pack; pack.router(*routerp).move(); - /* this only exits if graceful stop is received (sig_usr1_handler) */ - yaz_log(YLOG_LOG, "metaproxy stop"); - kill(-process_group, SIGTERM); /* kill all children processes as well */ + yaz_log(YLOG_LOG, "metaproxy stop"); /* only for graceful stop */ _exit(0); } -- 1.7.10.4