Move connect workaround to connect interface

This commit is contained in:
RipleyTom 2023-06-11 22:09:02 +02:00 committed by Megamouse
parent a6d8c4343f
commit e2bced978e
2 changed files with 5 additions and 7 deletions

View File

@ -224,10 +224,12 @@ std::optional<s32> lv2_socket_native::connect(const sys_net_sockaddr& addr)
return CELL_OK;
}
#ifdef _WIN32
sys_net_error result = get_last_error(!so_nbio, was_connecting);
#else
sys_net_error result = get_last_error(!so_nbio);
#ifdef _WIN32
// See https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect
if (was_connecting && (result == SYS_NET_EINVAL || result == SYS_NET_EWOULDBLOCK))
return -SYS_NET_EALREADY;
#endif
if (result)

View File

@ -93,10 +93,6 @@ sys_net_error convert_error(bool is_blocking, int native_error, [[maybe_unused]]
// Windows will return SYS_NET_ENOTCONN when recvfrom/sendto is called on a socket that is connecting but not yet connected
if (result == SYS_NET_ENOTCONN)
return SYS_NET_EAGAIN;
// See https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect
if (result == SYS_NET_EINVAL || result == SYS_NET_EWOULDBLOCK)
return SYS_NET_EALREADY;
}
#endif