diff --git a/includes/config.hpp b/includes/config.hpp index 8079e43..dc80f08 100644 --- a/includes/config.hpp +++ b/includes/config.hpp @@ -6,7 +6,7 @@ /* By: vvaas +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/22 09:45:10 by maldavid #+# #+# */ -/* Updated: 2024/01/30 17:34:11 by maldavid ### ########.fr */ +/* Updated: 2024/02/05 16:13:06 by vvaas ### ########.fr */ /* */ /******************************************************************************/ @@ -16,6 +16,7 @@ #define INPUT_SIZE 1024 #define LOGS_BUFFER_SIZE 4096 #define MAX_USERS 20 +#define FD_MAX 1023 #define NULL_SOCKET -1 #define LEGAL_CHARACTER "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789{}[]\\|^`-_" diff --git a/srcs/server.cpp b/srcs/server.cpp index a366168..44b71dc 100644 --- a/srcs/server.cpp +++ b/srcs/server.cpp @@ -6,7 +6,7 @@ /* By: vvaas +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/21 09:31:17 by maldavid #+# #+# */ -/* Updated: 2024/02/05 14:10:19 by vvaas ### ########.fr */ +/* Updated: 2024/02/05 16:14:13 by vvaas ### ########.fr */ /* */ /******************************************************************************/ @@ -232,5 +232,13 @@ namespace irc Server::~Server() { closeMainSocket(); + for(int i = 0; i < FD_MAX; ++i) + { + if (FD_ISSET(i, &_fd_set)) + { + close(i); + FD_CLR(i, &_fd_set); + } + } } }