mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 10:10:57 +00:00
Fix socket_connect_with_timeout for WIIU (#14483)
== DETAILS Previous work to clean up the HTTP networking code surfaced a bug in `socket_connect_with_timeout()` that caused connections to immediately fail. Specifically, achievements stopped working because the http task code path was rewritten to use `socket_connect_with_timeout` instead of `socket_connect`. The bug appears to come down to an unsupported socket option. The final check is to try to read `SO_ERROR` from the socket, and on WIIU the `getsockopt()` call returns -1 and sets `lastsocketerr()` (WIIU's equivalent to errno) to 16. The fix is to change the logic to only abort the connection if that `getsockopt()` call succeeds *and* the error is set.
This commit is contained in:
parent
0bdc761adb
commit
714878783a
@ -769,8 +769,8 @@ bool socket_connect_with_timeout(int fd, void *data, int timeout)
|
||||
int error = -1;
|
||||
socklen_t errsz = sizeof(error);
|
||||
|
||||
getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*)&error, &errsz);
|
||||
if (error)
|
||||
/* Only error out here if the getsockopt() call succeeds and error is still set. */
|
||||
if(!getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*)&error, &errsz) && error)
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user