malaise
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/21 09:12:28 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/22 17:00:02 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/22 17:21:23 by vvaas ### ########.fr */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace irc
|
||||
public:
|
||||
Server(int port, const std::string& password);
|
||||
|
||||
inline void closeMainSocket() { close(_main_socket); }
|
||||
inline void closeMainSocket() { if (_main_socket > 0) close(_main_socket); _main_socket = 0; _active = false; }
|
||||
void wait();
|
||||
|
||||
~Server();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/20 09:27:04 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/22 17:04:37 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/22 17:23:14 by vvaas ### ########.fr */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -23,7 +23,7 @@ static unstd::SharedPtr<irc::Server> server_ref;
|
||||
void signalsHandler(int foo)
|
||||
{
|
||||
(void)foo;
|
||||
if(server_ref)
|
||||
if (!server_ref)
|
||||
return;
|
||||
server_ref->closeMainSocket();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/21 09:31:17 by maldavid #+# #+# */
|
||||
/* Updated: 2024/01/22 17:00:42 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/22 17:23:23 by vvaas ### ########.fr */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace irc
|
||||
FD_SET((*it)->getFD(), &_fd_set);
|
||||
|
||||
tmp = select(MAX_USERS, &_fd_set, NULL, NULL, NULL); // SELECT blocks till a connection or message is received, and let only those in _fd_set
|
||||
if(tmp < 0)
|
||||
if(tmp < 0 && _main_socket != 0)
|
||||
logs::report(log_fatal_error, "select fd error");
|
||||
|
||||
if(FD_ISSET(_main_socket, &_fd_set)) // if it's a new connection
|
||||
@@ -118,7 +118,6 @@ namespace irc
|
||||
|
||||
logs::report(log_message, "User %d connected", _client.back()->getID());
|
||||
}
|
||||
|
||||
handleInput();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user