sceNetInet: Wait for blocking socket calls in emulated time

Host sockets are always non-blocking, so a game's blocking recv(), accept()
and so on came back with EAGAIN at once, and connect() and poll() blocked the
whole emulator in the host call instead. Now recv, recvfrom, send, sendto,
accept, connect, poll and select try once, and if the call would block on a
blocking socket (no SO_NBIO or MSG_DONTWAIT), the thread waits and a
CoreTiming event retries it every millisecond. It ends when the call completes
or fails, or when SO_RCVTIMEO/SO_SNDTIMEO runs out in emulated time.

Sockets accepted on Linux are made non-blocking too: unlike BSD and Windows,
Linux doesn't pass that on from the listening socket. select() rejects a
tv_usec of a second or more with EINVAL.

Hardware behaviour from pspautotests net/inet/blocking.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-27 17:03:59 +01:00
1 parent 4e156e8945
commit 22e0a1a536
4 files changed
+473 -253

No files matched your search

+2
View File
@@ -61,6 +61,8 @@ InetSocket *SocketManager::AdoptSocket(int *index, SOCKET hostSocket, const Inet
inetSock->type = derive->type;
inetSock->protocol = derive->protocol;
inetSock->nonblocking = derive->nonblocking; // should we inherit blocking state?
inetSock->recvTimeoutUs = derive->recvTimeoutUs;
inetSock->sendTimeoutUs = derive->sendTimeoutUs;
return inetSock;
}
}