🏗️」 wip: change mainloop to work has expected

This commit is contained in:
2025-04-25 13:27:46 +02:00
parent d15e9061d3
commit 8d4ef4095a
7 changed files with 49 additions and 77 deletions

View File

@ -6,26 +6,24 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/11 17:45:43 by adjoly #+# #+# */
/* Updated: 2025/04/22 11:51:27 by mmoussou ### ########.fr */
/* Updated: 2025/04/25 13:23:08 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <log.hpp>
#include <config/default.hpp>
#include <fcntl.h>
#include <log.hpp>
#include <netinet/in.h>
#include <stdexcept>
#include <sys/poll.h>
#include <vector>
namespace webserv {
namespace server {
struct client_data {
sockaddr_in sock_data;
pollfd poll_fd;
};
class Client;
class Server {
public:
@ -48,7 +46,7 @@ class Server {
*
* @param The fd of the client
*/
bool _handle_client(struct pollfd &, sockaddr_in *);
bool _handle_client(Client *);
/**
* @brief Can be used to fill the vector passed as parameters with all the
@ -85,8 +83,8 @@ class Server {
Logger *_log; // Pointer to the log class
std::vector<int> _fds_server; // The fds of the sockets
std::vector<struct pollfd> _client_fds; // A vector of all the poll fd
std::vector<sockaddr_in *>
_client_data; // vector of all the client sockaddr_in
std::vector<Client *> _client_data; // vector of all the client sockaddr_in
};
}; // namespace server
}; // namespace webserv