X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmain.c;h=d17647d72f227ee3c5a4d742ca2e739d0e1b06f1;hb=a40e0df080a82db2b1150492a8952cdfe3559185;hp=4c7c9f48f4b1d1ba5d3037fa0a4fc9c41fc496e7;hpb=e9d8fc51ef743296c6b788dcabba46cbfab05086;p=NeonServV5.git diff --git a/src/main.c b/src/main.c index 4c7c9f4..d17647d 100644 --- a/src/main.c +++ b/src/main.c @@ -47,22 +47,7 @@ #include "IOHandler.h" #include "statistics.h" -static struct { - time_t start_time; - int running : 1; - int restart : 1; - int run_as_daemon : 1; - int daemonized : 1; - int loglevel : 8; - int loaded_config : 1; - int running_threads : 8; - - int argc; - char **argv; - - char config[MAXLEN]; - char pidfile[MAXLEN]; -} process_state; +struct ProcessState process_state; static FILE *log_fptr = NULL; @@ -168,8 +153,8 @@ static int reload_configuration() { return 3; } free(modulelist); + event_reload(0); } - event_reload(!process_state.loaded_config); process_state.loaded_config = 1; return 0; } @@ -198,8 +183,25 @@ void initialize_subsystems() { } void shutdown_subsystems() { + free_sockets(1); + //wait 50ms (run iohandler) + { + struct timeval timeout, ctime1, ctime2; + gettimeofday(&ctime1, NULL); + ctime1.tv_usec += 50000; + if(ctime1.tv_usec > 1000000) { + ctime1.tv_usec -= 1000000; + ctime1.tv_sec++; + } + do { + timeout.tv_sec = 0; + timeout.tv_usec = 10000; + iohandler_poll_timeout(timeout); + gettimeofday(&ctime2, NULL); + } while(timeval_is_bigger(ctime1, ctime2)); + } stop_modules(); - free_sockets(); + free_sockets(0); qserver_free(); free_parser(); free_UserNode();