Skip to content

Commit

Permalink
sys_net: add a workaround for WSAPoll with timeout
Browse files Browse the repository at this point in the history
Don't call WSAPoll with empty socket list.
  • Loading branch information
Nekotekina committed Dec 29, 2019
1 parent 45dc5d9 commit d2410af
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions rpcs3/Emu/Cell/lv2/sys_net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
if (nfds == 0)
{
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])
Expand Down

0 comments on commit d2410af

Please sign in to comment.