Connection dos not use state, logical bug fix

master
Denes Matetelki 13 years ago
parent af283fa823
commit bc4301e1c1

@ -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;

@ -95,15 +95,15 @@ protected:
return;
}
Connection<T> *connection = new Connection<T>(client_socket);
Connection<T> *connection = new Connection<T>(
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<T>(
client_socket,
m_connection->getMsgParam() );
m_connectionPool[client_socket] = connection;
addFd( client_socket, POLLIN | POLLPRI );
}

Loading…
Cancel
Save