From a4b5037cb1ea07c5e18ae3b88abb61766e9158ba Mon Sep 17 00:00:00 2001 From: 3lswear Date: Tue, 8 Feb 2022 21:09:21 +0300 Subject: [PATCH] feat(socket): add min_config struct --- src/Server/Socket.cpp | 3 +++ src/Server/Socket.hpp | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Server/Socket.cpp b/src/Server/Socket.cpp index 3310bca..28caa4d 100644 --- a/src/Server/Socket.cpp +++ b/src/Server/Socket.cpp @@ -15,6 +15,9 @@ Socket::Socket(int domain, int type, int protocol, int port, std::string ip) _addres.sin_port = htons(port); _addres.sin_addr.s_addr = inet_addr(ip.c_str()); _addrlen = sizeof(_addres); + + min_config.ip = ip; + min_config.port = port; } Socket::~Socket() diff --git a/src/Server/Socket.hpp b/src/Server/Socket.hpp index 421abf7..2c5c370 100644 --- a/src/Server/Socket.hpp +++ b/src/Server/Socket.hpp @@ -2,6 +2,8 @@ #define SOCKET_HPP #include "webserv.hpp" +#include "ServerConfig.hpp" + class Socket { private: @@ -9,9 +11,9 @@ private: socklen_t _addrlen; struct sockaddr_in _addres; + Socket(); public: - Socket(); Socket(int domain, int type, int protocol, int port, std::string ip); int getSocketFd(void); struct sockaddr_in getAddres(void); @@ -25,9 +27,11 @@ public: int init(int nbr); void checkError(int fd, std::string str); + struct serverListen min_config; + ~Socket(); }; -#endif \ No newline at end of file +#endif