Skip to content

sceNetInet socket remap #19827

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

Merged
merged 19 commits into from
Jan 8, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix some closesocket bugs
  • Loading branch information
hrydgard committed Jan 8, 2025
commit fcb3d636b4fee9b6fb504f51d727941687b3ca9b
15 changes: 14 additions & 1 deletion Core/HLE/sceNetInet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,10 +798,17 @@ static int sceNetInetClose(int socket) {
return hleLogError(Log::sceNet, ERROR_INET_EBADF, "Bad socket #%d", socket);
}

int retVal = closesocket(socket);
int retVal = closesocket(inetSock->sock);
if (retVal == 0) {
inetSock->sock = 0;
inetSock->state = SocketState::Unused;
} else {
ERROR_LOG(Log::sceNet, "closesocket(%d) failed (socket=%d)", inetSock->sock, socket);
}
return hleLogSuccessI(Log::sceNet, retVal);
}

// TODO: How is this different than just sceNetInetClose?
static int sceNetInetCloseWithRST(int socket) {
WARN_LOG(Log::sceNet, "UNTESTED %s(%i) at %08x", __FUNCTION__, socket, currentMIPS->pc);

Expand All @@ -816,6 +823,12 @@ static int sceNetInetCloseWithRST(int socket) {
sl.l_linger = 0; // timeout interval in seconds
setsockopt(inetSock->sock, SOL_SOCKET, SO_LINGER, (const char*)&sl, sizeof(sl));
int retVal = closesocket(inetSock->sock);
if (retVal == 0) {
inetSock->sock = 0;
inetSock->state = SocketState::Unused;
} else {
ERROR_LOG(Log::sceNet, "closesocket(%d) failed (socket=%d)", inetSock->sock, socket);
}
return hleLogSuccessI(Log::sceNet, retVal);
}

Expand Down