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
Filter multi: simple refactor
[metaproxy-moved-to-github.git]
/
src
/
metaproxy_prog.cpp
diff --git
a/src/metaproxy_prog.cpp
b/src/metaproxy_prog.cpp
index
b598a81
..
2719870
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-2010 Index Data
+ Copyright (C) 2005-2011 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
@@
-56,23
+56,29
@@
static void sig_term_handler(int s)
}
#endif
}
#endif
-static void handler(void *data)
+static void handler_debug(void *data)
{
{
- routerp = (mp::RouterFleXML*) data;
-
-#if HAVE_UNISTD_H
- /* make the current working process group leader */
- setpgid(0, 0);
+#if HAVE_UNISTD_H
process_group = getpgid(0); // save process group ID
signal(SIGTERM, sig_term_handler);
#endif
process_group = getpgid(0); // save process group ID
signal(SIGTERM, sig_term_handler);
#endif
+ routerp = (mp::RouterFleXML*) data;
routerp->start();
mp::Package pack;
pack.router(*routerp).move(); /* should never exit */
}
routerp->start();
mp::Package pack;
pack.router(*routerp).move(); /* should never exit */
}
+static void handler_normal(void *data)
+{
+#if HAVE_UNISTD_H
+ /* make the current working process group leader */
+ setpgid(0, 0);
+#endif
+ handler_debug(data);
+}
+
static int sc_main(
yaz_sc_t s,
int argc, char **argv)
static int sc_main(
yaz_sc_t s,
int argc, char **argv)
@@
-199,7
+205,8
@@
static int sc_main(
yaz_sc_running(s);
yaz_sc_running(s);
- yaz_daemon("metaproxy", mode, handler, router, pidfile, uid);
+ yaz_daemon("metaproxy", mode, mode == YAZ_DAEMON_DEBUG ?
+ handler_debug : handler_normal, router, pidfile, uid);
}
catch (std::logic_error &e) {
yaz_log (YLOG_FATAL,"std::logic error: %s" , e.what() );
}
catch (std::logic_error &e) {
yaz_log (YLOG_FATAL,"std::logic error: %s" , e.what() );