Poll bug, poll, should check the current number of fds, not the max

master
Denes Matetelki 6 years ago
parent 0250d43bbe
commit 67ca668ff3

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

Loading…
Cancel
Save