Network/SocketPoller: Fix Wait not updating error parameter (fixes #79)

Former-commit-id: fd04ad1ef0b3c86e02d12251c384c5ee2976460d [formerly 57f72f946a0182c022ad8fc18aea1867914f6552] [formerly bbbadcedac8d46ff33f53a24053d1a9c06d09b8b [formerly f536546d45c326658845c287a1fa6d9d4f8c5a99]]
Former-commit-id: 94246df60ecd371a07a57c12586d1d6bc7279076 [formerly b693141c531e6a61a3e8bc703ad7adf0fdb7a12d]
Former-commit-id: cbaf3deb146ad0a38f59d890ea99d66d49d9f730
This commit is contained in:
Lynix 2016-10-05 00:50:27 +02:00
parent d8b7fad5f0
commit 7c1680ada7
2 changed files with 11 additions and 1 deletions

View File

@ -4,6 +4,7 @@
#include <Nazara/Network/Linux/SocketPollerImpl.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Network/Posix/SocketImpl.hpp>
#include <cstring>
#include <unistd.h>
#include <Nazara/Network/Debug.hpp>
@ -75,6 +76,13 @@ namespace Nz
std::memset(m_events.data(), 0, m_events.size() * sizeof(epoll_event));
activeSockets = epoll_wait(m_handle, m_events.data(), static_cast<int>(m_events.size()), static_cast<int>(msTimeout));
if (activeSockets == -1)
{
if (error)
*error = SocketImpl::TranslateErrnoToResolveError(errno);
return 0;
}
m_activeSockets.clear();
if (activeSockets > 0U)
@ -96,6 +104,9 @@ namespace Nz
}
}
if (error)
*error = SocketError_NoError;
return activeSockets;
}
}

View File

@ -9,7 +9,6 @@
#include <Nazara/Network/IpAddress.hpp>
#include <Nazara/Network/SocketHandle.hpp>
#include <Nazara/Network/Posix/SocketImpl.hpp>
#include <unordered_set>
#include <vector>
#include <sys/epoll.h>