From: Adam Dickmeiss Date: Wed, 9 May 2012 10:23:47 +0000 (+0200) Subject: Use yaz_daemon_stop for graceful stop X-Git-Tag: v1.3.35~5 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=4c528bfa11ac8640b5bf8f7018d0d096d30081df;p=metaproxy-moved-to-github.git Use yaz_daemon_stop for graceful stop --- 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); }