mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-17 03:14:34 +01:00
sceNetInet: errno per thread as on hardware, and the socket table
errno: - A thread that hasn't made a call yet reads 0x80410001 from GetErrno, as the PSP has no errno record for it until then. errno is saved in savestates now, in a new sceNet section version. - socket(), close() and setsockopt() clear it when they succeed. - Running out of descriptors is EMFILE, at 255 like the PSP, and an unconnected UDP socket sending without an address EDESTADDRREQ, which Winsock calls ENOTCONN. - On Windows, ENOBUFS, EPROTOTYPE, ENOPROTOOPT, EMSGSIZE, ENETRESET and EDESTADDRREQ now map to the PSP's errnos. They only did elsewhere. All from pspautotests net/inet/errors, options and errnothread. The socket table: - Descriptor numbers are handed out round-robin up to 255, as on the PSP (net/inet/states), rather than the lowest free one. - Closing frees the slot even if the host's close fails, and Close and CloseAll take the lock the rest of SocketManager does. - accept no longer leaks the host socket when it runs out of numbers. - bind no longer asks UPnP to forward port 0, and closing the socket removes its forward, unless another socket still uses the port. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
be9c244938
commit
79537d18bd
8 files changed
+208
-77
No files matched your search
@@ -805,6 +805,8 @@ int convertInetErrnoHost2PSP(int error) {
|
||||
return ERROR_INET_EFAULT;
|
||||
case EINVAL:
|
||||
return ERROR_INET_EINVAL;
|
||||
case EMFILE:
|
||||
return ERROR_INET_EMFILE;
|
||||
case ENOSPC:
|
||||
return ERROR_INET_ENOSPC;
|
||||
case EPIPE:
|
||||
@@ -872,6 +874,22 @@ int convertInetErrnoHost2PSP(int error) {
|
||||
return ERROR_INET_EMSGSIZE;
|
||||
case ENETRESET:
|
||||
return ERROR_INET_ENETRESET;
|
||||
case EDESTADDRREQ:
|
||||
return ERROR_INET_EDESTADDRREQ;
|
||||
#else
|
||||
// The ones above, by their Winsock names.
|
||||
case WSAENOBUFS:
|
||||
return ERROR_INET_ENOBUFS;
|
||||
case WSAEPROTOTYPE:
|
||||
return ERROR_INET_EPROTOTYPE;
|
||||
case WSAENOPROTOOPT:
|
||||
return ERROR_INET_ENOPROTOOPT;
|
||||
case WSAEMSGSIZE:
|
||||
return ERROR_INET_EMSGSIZE;
|
||||
case WSAENETRESET:
|
||||
return ERROR_INET_ENETRESET;
|
||||
case WSAEDESTADDRREQ:
|
||||
return ERROR_INET_EDESTADDRREQ;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
@@ -889,6 +907,7 @@ const char *convertInetErrno2str(int error) {
|
||||
case ERROR_INET_EACCES: return "EACCES";
|
||||
case ERROR_INET_EFAULT: return "EFAULT";
|
||||
case ERROR_INET_EINVAL: return "EINVAL";
|
||||
case ERROR_INET_EMFILE: return "EMFILE";
|
||||
case ERROR_INET_ENOSPC: return "ENOSPC";
|
||||
case ERROR_INET_EPIPE: return "EPIPE";
|
||||
case ERROR_INET_ENOMSG: return "ENOMSG";
|
||||
@@ -918,6 +937,7 @@ const char *convertInetErrno2str(int error) {
|
||||
case ERROR_INET_ESOCKTNOSUPPORT: return "ESOCKTNOSUPPORT";
|
||||
case ERROR_INET_EADDRNOTAVAIL: return "EADDRNOTAVAIL";
|
||||
case ERROR_INET_ENETRESET: return "ENETRESET";
|
||||
case ERROR_INET_EDESTADDRREQ: return "EDESTADDRREQ";
|
||||
case ERROR_INET_EISCONN: return "EISCONN";
|
||||
case ERROR_INET_ENOTCONN: return "ENOTCONN";
|
||||
case ERROR_INET_EAGAIN: return "EAGAIN";
|
||||
|
||||
Reference in new issue
Block a user