diff --git a/srcs/httpserver/src/haywire/http_server.c b/srcs/httpserver/src/haywire/http_server.c index 448538b..8267285 100644 --- a/srcs/httpserver/src/haywire/http_server.c +++ b/srcs/httpserver/src/haywire/http_server.c @@ -41,12 +41,12 @@ static struct sockaddr_in listen_address; uv_loop_t *uv_loop; void *routes; -//hw_string* http_v1_0; +hw_string* http_v1_0; hw_string *http_v1_1; hw_string *server_name; int listener_count; uv_async_t *listener_async_handles; -//uv_loop_t* listener_event_loops; +uv_loop_t* listener_event_loops; uv_barrier_t *listeners_created_barrier; int hw_init_with_config(configuration *c) { @@ -132,7 +132,7 @@ void hw_http_add_route(char *route, http_request_callback callback, void *user_d routes = kh_init(string_hashmap); } set_route(routes, route, route_entry); - dzlog_debug("Added route %s\n", route);// TODO: Replace with logging instead. + dzlog_debug("Added route path: [%s]\n", route);// TODO: Replace with logging instead. } void free_http_server() { @@ -145,6 +145,8 @@ void free_http_server() { free((char *)v); }); kh_destroy(string_hashmap, routes); + + dzlog_debug("HTTP Server Close http://%s:%d\n", config->http_listen_address, config->http_listen_port); } int hw_http_open() { @@ -216,7 +218,7 @@ int hw_http_open() { uv_listen((uv_stream_t *)&server, (int)config->listen_backlog, http_stream_on_connect); print_configuration(); - dzlog_debug("Listening...\n"); + dzlog_debug("HTTP Server Listening at http://%s:%d\n", config->http_listen_address, config->http_listen_port); //uv_run(uv_loop, UV_RUN_DEFAULT); } else if (listener_count > 0 && strcmp(config->balancer, "ipc") == 0) { int i; diff --git a/srcs/libs/init/init.c b/srcs/libs/init/init.c index f4dbe09..332f0a3 100644 --- a/srcs/libs/init/init.c +++ b/srcs/libs/init/init.c @@ -26,7 +26,8 @@ static pid_t g_pid; static void catch_system_interupt(int UNUSED(sig_num)) { if (g_pid == uv_os_getpid()) { - printf("\nSystem close, clearing system resources..........\n"); + printf("\n"); + dzlog_warn("System close, clearing system resources..........\n\n"); task_manager_exit(); sleep(1); } @@ -124,7 +125,8 @@ int user_init(const char *pAppCfgFile, const char *pCfgDirectory, const char *pK void user_uninit() { task_manager_exit(); free_http_server(); - zlog_fini(); + uv_sleep(1000); mq_uninit(); + zlog_fini(); uv_loop_close(get_task_manager()); } diff --git a/srcs/libs/task/task_manager.c b/srcs/libs/task/task_manager.c index be7b626..b1985a1 100644 --- a/srcs/libs/task/task_manager.c +++ b/srcs/libs/task/task_manager.c @@ -3,6 +3,7 @@ // #include +#include #include "task_manager.h" #include "misc.h" #include "uthash/utlist.h" @@ -36,7 +37,7 @@ int is_system_cleanup() { } static int is_task_exit() { - return (g_taskManagerExit == TRUE); + return g_taskManagerExit; } int task_add_exit_event_handler(system_exit_cb cb, void *userdata) { @@ -83,7 +84,6 @@ void task_manager_run() { free(pCtx); } + dzlog_info("Main task exited..............\n"); g_isSystemExit = TRUE; - - printf("main task exit..............\n"); } \ No newline at end of file diff --git a/srcs/open_dhcp/opendhcpd.cpp b/srcs/open_dhcp/opendhcpd.cpp index 37f5386..56ffd7e 100644 --- a/srcs/open_dhcp/opendhcpd.cpp +++ b/srcs/open_dhcp/opendhcpd.cpp @@ -586,11 +586,9 @@ void on_system_exit(void *p) { close(cfig.fixedSocket); - sprintf(logBuff, "Open DHCP Server Stopped !\n"); + sprintf(logBuff, "Open DHCP Server Stopped !"); logDHCPMess(logBuff, 1); sleep(1); - - exit(EXIT_SUCCESS); } } diff --git a/srcs/vcpe_main.c b/srcs/vcpe_main.c index 12b0592..6d5aedb 100644 --- a/srcs/vcpe_main.c +++ b/srcs/vcpe_main.c @@ -81,7 +81,6 @@ int main(int argc, char **argv) { } user_uninit(); - return 0; #endif }