diff options
author | deva <deva> | 2008-08-15 09:37:36 +0000 |
---|---|---|
committer | deva <deva> | 2008-08-15 09:37:36 +0000 |
commit | 5ccdf6dd987be086a8712a4960f770122b1b499b (patch) | |
tree | 7999dd2a4b9e4e3aaccf3493cd7826528ddd1c01 /server/src/pracrod.cc | |
parent | b7be78948cad7629427fd19769ddcfdfea3fb666 (diff) |
Changes for read-loop-server.
Diffstat (limited to 'server/src/pracrod.cc')
-rw-r--r-- | server/src/pracrod.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/server/src/pracrod.cc b/server/src/pracrod.cc index 6ee1817..6ca21db 100644 --- a/server/src/pracrod.cc +++ b/server/src/pracrod.cc @@ -33,6 +33,9 @@ #include <sys/types.h> #include <unistd.h> +// For waitpid +#include <sys/wait.h> + // For signal #include <signal.h> @@ -85,6 +88,24 @@ static const char usage_str[] = ConfigurationParser *configparser = NULL; +bool pracro_is_running = true; + +void ctrl_c(int) +{ + // printf("Ctrl+c\n"); + pracro_is_running = false; +} + +void childwait(int) +{ + // printf("childwait\n"); + + pid_t pid; + while((pid = waitpid(-1, NULL, WNOHANG)) > 0) { + // printf("\tOne down!\n"); + } +} + void reload(int) { int port; @@ -183,6 +204,10 @@ int main(int argc, char *argv[]) group = strdup(Conf::server_group.c_str()); } + signal(SIGHUP, reload); + signal(SIGCLD, childwait); + if(foreground) signal (SIGINT, ctrl_c); + PracroDaemon daemon; daemon.run(user, group, !foreground); |