mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-05-10 19:18:46 +02:00
「🏗️」 wip: change mainloop to work has expected
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/14 14:14:39 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/25 12:43:54 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/04/25 13:20:13 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -24,8 +24,8 @@ namespace server {
|
||||
class Client {
|
||||
public:
|
||||
Client();
|
||||
Client(struct pollfd, sockaddr_in, config::Config *);
|
||||
void parse(struct pollfd, sockaddr_in, config::Config *);
|
||||
Client(struct pollfd *, sockaddr_in, config::Config *);
|
||||
void parse(void);
|
||||
virtual ~Client(void);
|
||||
|
||||
void answer(void);
|
||||
@ -33,11 +33,12 @@ class Client {
|
||||
private:
|
||||
void _getRequest(std::string);
|
||||
|
||||
struct pollfd _fd;
|
||||
struct pollfd *_pfd;
|
||||
struct sockaddr_in _client_addr;
|
||||
http::IRequest *_request;
|
||||
//http::Response *_response;
|
||||
config::Server *_conf;
|
||||
// http::Response *_response;
|
||||
config::Server *_conf;
|
||||
config::Config *_Gconf;
|
||||
};
|
||||
|
||||
} // namespace server
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user