mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-12-28 00:18:23 +00:00
sys_net: add a workaround for WSAPoll with timeout
Don't call WSAPoll with empty socket list.
This commit is contained in:
parent
45dc5d9b02
commit
01b1b21efd
@ -83,7 +83,25 @@ void fmt_class_string<sys_net_error>::format(std::string& out, u64 arg)
|
||||
// Workaround function for WSAPoll not reporting failed connections
|
||||
void windows_poll(pollfd* fds, unsigned long nfds, int timeout, bool* connecting)
|
||||
{
|
||||
// Don't call WSAPoll with zero nfds (errors 10022 or 10038)
|
||||
if (std::none_of(fds, fds + nfds, [](pollfd& pfd) { return pfd.fd != INVALID_SOCKET; }))
|
||||
{
|
||||
if (timeout > 0)
|
||||
{
|
||||
Sleep(timeout);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int r = ::WSAPoll(fds, nfds, timeout);
|
||||
|
||||
if (r == SOCKET_ERROR)
|
||||
{
|
||||
sys_net.error("WSAPoll failed: %u", WSAGetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
for (unsigned long i = 0; i < nfds; i++)
|
||||
{
|
||||
if (connecting[i])
|
||||
|
Loading…
Reference in New Issue
Block a user