diff --git a/src/Nazara/Network/Posix/SocketPollerImpl.cpp b/src/Nazara/Network/Posix/SocketPollerImpl.cpp index 6b279ec50..4242e79a9 100644 --- a/src/Nazara/Network/Posix/SocketPollerImpl.cpp +++ b/src/Nazara/Network/Posix/SocketPollerImpl.cpp @@ -76,12 +76,13 @@ namespace Nz m_activeSockets.clear(); if (activeSockets > 0U) { + int socketRemaining = activeSockets; for (PollSocket& entry : m_sockets) { if (entry.revents & POLLRDNORM) { m_activeSockets.insert(entry.fd); - if (--activeSockets == 0) + if (--socketRemaining == 0) break; } } diff --git a/src/Nazara/Network/Win32/SocketPollerImpl.cpp b/src/Nazara/Network/Win32/SocketPollerImpl.cpp index b71e5107c..dd80c233d 100644 --- a/src/Nazara/Network/Win32/SocketPollerImpl.cpp +++ b/src/Nazara/Network/Win32/SocketPollerImpl.cpp @@ -112,12 +112,13 @@ namespace Nz m_activeSockets.clear(); if (activeSockets > 0U) { + int socketRemaining = activeSockets; for (PollSocket& entry : m_sockets) { if (entry.revents & POLLRDNORM) { m_activeSockets.insert(entry.fd); - if (--activeSockets == 0) + if (--socketRemaining == 0) break; } }