mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-05-10 19:38:45 +02:00
「🔨」 fix: merge conflic on socket.cpp
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/11 17:45:43 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/17 18:45:07 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/20 12:37:23 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -22,6 +22,11 @@
|
||||
|
||||
namespace webserv {
|
||||
|
||||
struct client_data {
|
||||
sockaddr_in sock_data;
|
||||
pollfd poll_fd;
|
||||
};
|
||||
|
||||
class Server {
|
||||
public:
|
||||
Server(config::Config *);
|
||||
@ -43,7 +48,7 @@ class Server {
|
||||
*
|
||||
* @param The fd of the client
|
||||
*/
|
||||
void _handle_client(int, sockaddr_in, struct pollfd);
|
||||
bool _handle_client(struct pollfd &, sockaddr_in *);
|
||||
|
||||
/**
|
||||
* @brief Can be used to fill the vector passed as parameters with all the
|
||||
@ -60,11 +65,28 @@ class Server {
|
||||
*/
|
||||
int _createSocket(std::string, int);
|
||||
|
||||
/**
|
||||
* @brief Can be used to check if an fd is one of the socket or not
|
||||
*
|
||||
* @param the fd to check
|
||||
*/
|
||||
bool _isServerSocket(int fd) {
|
||||
for (std::vector<int>::iterator it = _fds_server.begin();
|
||||
it != _fds_server.end(); it++) {
|
||||
if (fd == *it) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
config::Config
|
||||
*_conf; // Pointer to the configuration class (with all config in)
|
||||
Logger *_log; // Pointer to the log class
|
||||
std::vector<int> _fds_server; // The fds of the sockets
|
||||
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
|
||||
};
|
||||
|
||||
}; // namespace webserv
|
||||
|
Reference in New Issue
Block a user