From e2bced978e21d4278cdf709fed35b8923a97ef90 Mon Sep 17 00:00:00 2001 From: RipleyTom Date: Sun, 11 Jun 2023 22:09:02 +0200 Subject: [PATCH] Move connect workaround to connect interface --- rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_native.cpp | 8 +++++--- rpcs3/Emu/Cell/lv2/sys_net/sys_net_helpers.cpp | 4 ---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_native.cpp b/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_native.cpp index 05533fb95d..966027727f 100644 --- a/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_native.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_native.cpp @@ -224,10 +224,12 @@ std::optional 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) diff --git a/rpcs3/Emu/Cell/lv2/sys_net/sys_net_helpers.cpp b/rpcs3/Emu/Cell/lv2/sys_net/sys_net_helpers.cpp index bcce88b679..4acd422892 100644 --- a/rpcs3/Emu/Cell/lv2/sys_net/sys_net_helpers.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_net/sys_net_helpers.cpp @@ -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