Network/SocketPoller: Wait() now returns the number of active sockets, and optionally the last error

It will also ignore the EINTR error on Linux
This commit is contained in:
Jérôme Leclercq
2018-06-12 14:31:49 +02:00
parent 15f84dc712
commit 56b23a2f27
16 changed files with 120 additions and 94 deletions

View File

@@ -81,7 +81,7 @@ namespace Nz
NazaraWarning("An error occured while removing socket from epoll structure (errno " + String::Number(errno) + ": " + Error::GetLastSystemError() + ')');
}
int SocketPollerImpl::Wait(int msTimeout, SocketError* error)
unsigned int SocketPollerImpl::Wait(int msTimeout, SocketError* error)
{
int activeSockets;
@@ -93,7 +93,7 @@ namespace Nz
if (activeSockets == -1)
{
if (error)
*error = SocketImpl::TranslateErrnoToResolveError(errno);
*error = SocketImpl::TranslateErrnoToSocketError(errno);
return 0;
}

View File

@@ -30,7 +30,7 @@ namespace Nz
bool RegisterSocket(SocketHandle socket, SocketPollEventFlags eventFlags);
void UnregisterSocket(SocketHandle socket);
int Wait(int msTimeout, SocketError* error);
unsigned int Wait(int msTimeout, SocketError* error);
private:
std::unordered_set<SocketHandle> m_readyToReadSockets;