Network/SocketPoller: Uniformize behavior accross platforms
On Windows, a closed connection will mark as ready for read/write
This commit is contained in:
parent
d1eac591f5
commit
874599fefd
|
|
@ -111,9 +111,6 @@ namespace Nz
|
|||
|
||||
if (m_events[i].events & (EPOLLOUT | EPOLLERR))
|
||||
m_readyToWriteSockets.insert(m_events[i].data.fd);
|
||||
|
||||
if (m_events[i].events & EPOLLERR)
|
||||
NazaraWarning("Descriptor " + String::Number(m_events[i].data.fd) + " was returned by epoll with EPOLLERR status");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -90,12 +90,12 @@ namespace Nz
|
|||
int socketRemaining = activeSockets;
|
||||
for (PollSocket& entry : m_sockets)
|
||||
{
|
||||
if (entry.revents != 0)
|
||||
if (entry.revents & (POLLRDNORM | POLLWRNORM | POLLHUP | POLLERR))
|
||||
{
|
||||
if (entry.revents & POLLRDNORM)
|
||||
if (entry.revents & (POLLRDNORM | POLLHUP | POLLERR))
|
||||
m_readyToReadSockets.insert(entry.fd);
|
||||
|
||||
if (entry.revents & POLLWRNORM)
|
||||
if (entry.revents & (POLLWRNORM | POLLERR))
|
||||
m_readyToWriteSockets.insert(entry.fd);
|
||||
|
||||
entry.revents = 0;
|
||||
|
|
@ -103,6 +103,11 @@ namespace Nz
|
|||
if (--socketRemaining == 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
NazaraWarning("Socket " + String::Number(entry.fd) + " was returned by WSAPoll without POLLRDNORM nor POLLWRNORM events (events: 0x" + String::Number(entry.events, 16) + ')');
|
||||
activeSockets--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,12 +143,12 @@ namespace Nz
|
|||
int socketRemaining = activeSockets;
|
||||
for (PollSocket& entry : m_sockets)
|
||||
{
|
||||
if (entry.revents != 0)
|
||||
if (entry.revents & (POLLRDNORM | POLLWRNORM | POLLHUP | POLLERR))
|
||||
{
|
||||
if (entry.revents & POLLRDNORM)
|
||||
if (entry.revents & (POLLRDNORM | POLLHUP | POLLERR))
|
||||
m_readyToReadSockets.insert(entry.fd);
|
||||
|
||||
if (entry.revents & POLLWRNORM)
|
||||
if (entry.revents & (POLLWRNORM | POLLERR))
|
||||
m_readyToWriteSockets.insert(entry.fd);
|
||||
|
||||
entry.revents = 0;
|
||||
|
|
@ -156,6 +156,11 @@ namespace Nz
|
|||
if (--socketRemaining == 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
NazaraWarning("Socket " + String::Number(entry.fd) + " was returned by WSAPoll without POLLRDNORM nor POLLWRNORM events (events: 0x" + String::Number(entry.events, 16) + ')');
|
||||
activeSockets--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue