Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move connect workaround to connect interface #14006

Merged
merged 3 commits into from Jun 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_native.cpp
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions rpcs3/Emu/Cell/lv2/sys_net/sys_net_helpers.cpp
Expand Up @@ -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

Expand Down