diff options
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); |