diff --git a/http-server.c b/http-server.c index 56e985ca80faecf130efbe12b6e0511b9087c4c4..35259018adafb9c3154b06cfdb85d113c5e360a1 100644 --- a/http-server.c +++ b/http-server.c @@ -41,10 +41,14 @@ static int const HTTP_400_LENGTH = 47; static char const * const HTTP_404 = "HTTP/1.1 404 Not Found\r\nContent-Length: 0\r\n\r\n"; static int const HTTP_404_LENGTH = 45; +<<<<<<< http-server.c // global structures required for memory deallocation static Request* req; static User_list* user_list; int keep_alive = 1; +======= +volatile sig_atomic_t kill; +>>>>>>> http-server.c bool player_session(char* buff, int sockfd, char* file_name, char* response){ @@ -371,14 +375,19 @@ static bool handle_http_request(int sockfd, User_list *user_list){ return true; } -static void exit_handler(int sig){ +void exit_handler(int signum){ /** * Closes TCP Connection */ +<<<<<<< http-server.c keep_alive = 0; if (user_list){ free_users(user_list); } +======= + kill = 1; + printf("keep alive changed"); +>>>>>>> http-server.c } @@ -435,7 +444,7 @@ int main(int argc, char * argv[]) // game players user_list = initialise_player_list(); signal(SIGINT, exit_handler); - while (keep_alive) + while (!kill) { // monitor file descriptors fd_set readfds = masterfds;