projects
/
metaproxy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Log when SIG{TERM,USR1} is received ASAP MP-513
[metaproxy-moved-to-github.git]
/
src
/
metaproxy_prog.cpp
diff --git
a/src/metaproxy_prog.cpp
b/src/metaproxy_prog.cpp
index
a4ec7f0
..
481901b
100644
(file)
--- a/
src/metaproxy_prog.cpp
+++ b/
src/metaproxy_prog.cpp
@@
-1,5
+1,5
@@
/* This file is part of Metaproxy.
/* This file is part of Metaproxy.
- Copyright (C) 2005-2013 Index Data
+ Copyright (C) Index Data
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@
-58,19
+58,22
@@
static void set_log_prefix(void)
#if HAVE_UNISTD_H
static pid_t process_group = 0;
#if HAVE_UNISTD_H
static pid_t process_group = 0;
+static int sig_received = 0;
-static void sig_usr1_handler(int s)
+static void sig_usr1_handler(int signo)
{
{
- yaz_log(YLOG_LOG, "metaproxy received SIGUSR1");
- routerp->stop();
+ sig_received = signo;
+ if (routerp)
+ routerp->stop(signo);
}
}
-static void sig_term_handler(int s)
+static void sig_term_handler(int signo)
{
{
- yaz_log(YLOG_LOG, "metaproxy received SIGTERM");
- yaz_log(YLOG_LOG, "metaproxy stop");
- kill(-process_group, SIGTERM); /* kill all children processes as well */
- _exit(0);
+ sig_received = signo;
+ if (routerp)
+ {
+ routerp->stop(signo);
+ }
}
#endif
}
#endif
@@
-88,7
+91,9
@@
static void work_common(void *data)
mp::Package pack;
pack.router(*routerp).move();
mp::Package pack;
pack.router(*routerp).move();
- yaz_log(YLOG_LOG, "metaproxy stop"); /* only for graceful stop */
+ yaz_log(YLOG_LOG, "metaproxy stop");
+ delete routerp;
+ routerp = 0;
#if HAVE_UNISTD_H
kill(-process_group, SIGTERM); /* kill all children processes as well */
#endif
#if HAVE_UNISTD_H
kill(-process_group, SIGTERM); /* kill all children processes as well */
#endif