diff options
author | Laurent Ghigonis <laurent@p1sec.com> | 2012-12-04 13:45:13 +0100 |
---|---|---|
committer | Laurent Ghigonis <laurent@p1sec.com> | 2012-12-04 13:45:13 +0100 |
commit | 7d05a6ac539a4e097e3e7a93bb364eed27e97035 (patch) | |
tree | 7c64d1289b6c2cc47c50c73be4b96968b1284784 | |
parent | fix conntimer event setup (diff) | |
download | glouglou-7d05a6ac539a4e097e3e7a93bb364eed27e97035.tar.xz glouglou-7d05a6ac539a4e097e3e7a93bb364eed27e97035.zip |
stop the servers in the main(), not in signal handlers !
it's bad practise to do any processing in signal handlers.
-rw-r--r-- | glougloud/glougloud.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/glougloud/glougloud.c b/glougloud/glougloud.c index eab250c..4c08dec 100644 --- a/glougloud/glougloud.c +++ b/glougloud/glougloud.c @@ -45,11 +45,8 @@ static void sig_handler(int sig, short why, void *data) { printf("glougloud: got signal %d\n", sig); - if (sig == SIGINT || sig == SIGTERM) { + if (sig == SIGINT || sig == SIGTERM) event_base_loopexit(ev_base, NULL); - gg_server_stop(ggserv_probes); - gg_server_stop(ggserv_analysers); - } } int @@ -99,6 +96,9 @@ main(int argc, char **argv) event_base_dispatch(ev_base); + gg_server_stop(ggserv_probes); + gg_server_stop(ggserv_analysers); + return 0; } |