🏗️」 wip: passed _log to a global pointer

This commit is contained in:
2025-04-18 10:09:46 +02:00
parent 0b77d7b80c
commit a2cf80bfde
12 changed files with 52 additions and 35 deletions

View File

@ -6,11 +6,12 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/17 11:12:41 by mmoussou #+# #+# */
/* Updated: 2025/04/17 18:48:17 by adjoly ### ########.fr */
/* Updated: 2025/04/18 10:03:57 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include <server/Client.hpp>
#include <log.hpp>
using namespace server;

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/11 16:11:40 by adjoly #+# #+# */
/* Updated: 2025/04/17 18:57:20 by adjoly ### ########.fr */
/* Updated: 2025/04/18 09:19:14 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -85,6 +85,7 @@ void Server::_run(void) {
_client_fds.push_back(fd);
}
// to add signal instead of 727
while (727) {
int ret = poll(_client_fds.data(), nbr_client, -1);
if (ret < 0) {

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/17 11:58:42 by adjoly #+# #+# */
/* Updated: 2025/04/17 19:03:27 by adjoly ### ########.fr */
/* Updated: 2025/04/18 09:37:32 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -41,8 +41,13 @@ int Server::_createSocket(std::string host, int port) {
str << port;
throw std::runtime_error("socket binding failed for : " + host + ":" +
str.str());
return -1;
}
if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
close(fd);
throw std::runtime_error("fcntl failed");
}
return -1;
int opt = 1;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {