diff --git a/lib/cpp_utils/Poll.cpp b/lib/cpp_utils/Poll.cpp index 9202369..161946f 100644 --- a/lib/cpp_utils/Poll.cpp +++ b/lib/cpp_utils/Poll.cpp @@ -21,7 +21,11 @@ Poll::Poll( StreamConnection *connection, , m_num_of_fds(0) { TRACE; + + // We could initialize each .events = -1 so poll would skip them m_fds = new pollfd[m_maxclients+1]; // plus the server socket + + addFd( m_connection->getSocket(), POLLIN | POLLPRI ); } @@ -40,7 +44,7 @@ void Poll::startPolling() m_polling = true; while ( m_polling ) { - int ret = poll( m_fds , m_maxclients, m_timeOut); + int ret = poll( m_fds , m_num_of_fds, m_timeOut); if ( ret == -1 ) { LOG( Logger::ERR, errnoToString("ERROR polling. ").c_str() );