diff options
Diffstat (limited to 'src/socketengines/socketengine_poll.cpp')
-rw-r--r-- | src/socketengines/socketengine_poll.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/socketengines/socketengine_poll.cpp b/src/socketengines/socketengine_poll.cpp index ca9bfd1ea..46a517c51 100644 --- a/src/socketengines/socketengine_poll.cpp +++ b/src/socketengines/socketengine_poll.cpp @@ -64,7 +64,6 @@ public: PollEngine::PollEngine() : events(1), fd_mappings(1) { - CurrentSetSize = 0; struct rlimit limits; if (!getrlimit(RLIMIT_NOFILE, &limits)) { @@ -103,14 +102,14 @@ bool PollEngine::AddFd(EventHandler* eh, int event_mask) return false; } + unsigned int index = CurrentSetSize; + if (!SocketEngine::AddFdRef(eh)) { ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Attempt to add duplicate fd: %d", fd); return false; } - unsigned int index = CurrentSetSize; - while (static_cast<unsigned int>(fd) >= fd_mappings.size()) fd_mappings.resize(fd_mappings.size() * 2, -1); fd_mappings[fd] = index; @@ -121,7 +120,6 @@ bool PollEngine::AddFd(EventHandler* eh, int event_mask) ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "New file descriptor: %d (%d; index %d)", fd, events[index].events, index); SocketEngine::SetEventMask(eh, event_mask); - CurrentSetSize++; return true; } @@ -176,8 +174,6 @@ void PollEngine::DelFd(EventHandler* eh) SocketEngine::DelFdRef(eh); - CurrentSetSize--; - ServerInstance->Logs->Log("SOCKET", LOG_DEBUG, "Remove file descriptor: %d (index: %d) " "(Filled gap with: %d (index: %d))", fd, index, last_fd, last_index); } |