diff --git a/include/Connection.hpp b/include/Connection.hpp index 6b9448b..2effdad 100644 --- a/include/Connection.hpp +++ b/include/Connection.hpp @@ -16,18 +16,12 @@ class Connection { public: - enum Status { - OPENED, - CLOSED - }; - Connection ( const int socket, void *msgParam = 0, const size_t bufferLength = 1024 ) : m_socket(socket) , m_host() , m_port() - , m_status(CLOSED) , m_message(this, msgParam) , m_buffer(0) , m_bufferLength(bufferLength) @@ -46,7 +40,6 @@ public: : m_socket(AF_INET, SOCK_STREAM) , m_host(host) , m_port(port) - , m_status(CLOSED) , m_message(this, msgParam) , m_buffer(0) , m_bufferLength(bufferLength) @@ -151,7 +144,6 @@ private: Socket m_socket; std::string m_host; std::string m_port; - Status m_status; T m_message; unsigned char *m_buffer; diff --git a/include/Poll.hpp b/include/Poll.hpp index 4aa7d8a..30b8764 100644 --- a/include/Poll.hpp +++ b/include/Poll.hpp @@ -95,15 +95,15 @@ protected: return; } - Connection *connection = new Connection(client_socket); + Connection *connection = new Connection( + client_socket, + m_connection->getMsgParam() ); LOG( Logger::INFO, std::string("New client connected: "). append(connection->getHost()).append(":"). append(connection->getPort()).c_str() ); - m_connectionPool[client_socket] = new Connection( - client_socket, - m_connection->getMsgParam() ); + m_connectionPool[client_socket] = connection; addFd( client_socket, POLLIN | POLLPRI ); }