mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-01 12:07:31 +01:00
sceNetInet: TCP socket states and bind's port sharing
Following pspautotests net/inet/errors, states and reuse: - bind decides itself whether a port is in use, as 4.4BSD's in_pcbbind() does with SO_REUSEADDR and SO_REUSEPORT. The host can't, since its sockets have both on for running several instances, so any number of sockets could bind the same port. A socket that's bound already is EINVAL. - Shutting down the sending side of an unconnected TCP socket, or a failed connect, throws away its TCP state as in 4.4BSD's tcp_usrreq(), after which bind, listen, connect, accept and shutdown fail with EINVAL, and its port is free again. shutdown otherwise only fails for a bad how, and still reaches the host, so a thread waiting in accept wakes up. - listen on an unbound TCP socket binds one, which Winsock didn't, and on a connected one succeeds. - connect on a listening socket is EOPNOTSUPP. Winsock's WSAEINVAL for it looked like a connect in progress, and a blocking socket waited forever. A second connect on a loopback connection the host hasn't noticed finishing is EISCONN once it has. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7da0be4f0a
commit
3ee22fbd3d
4 files changed
+138
-13
No files matched your search
@@ -87,6 +87,9 @@ InetSocket *SocketManager::AdoptSocket(int *index, SOCKET hostSocket, const Inet
|
||||
inetSock->addr.clear();
|
||||
inetSock->port = 0;
|
||||
inetSock->upnpPort = 0;
|
||||
inetSock->boundPort = 0;
|
||||
inetSock->tcpClosed = false;
|
||||
inetSock->listening = false;
|
||||
return inetSock;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user