A PSP keeps what arrives in the socket's buffer, of the size given to
PdpCreate, and drops a datagram that doesn't fit: a buffer of 0 gets
nothing, one of 2048 bytes only some of ten 1000-byte datagrams
(pspautotests net/adhoc/pair/flow). Each transport now only hands over
the datagrams that have arrived (PdpTakeDatagram), into a queue per
socket that is filled every millisecond and whenever the game looks, and
PdpRecv, its blocking retry, GetPdpStat, PollSocket and game mode read
from that. This replaces each transport's own receive paths, so the
relay now reports the sender with NOT_ENOUGH_SPACE too, and P2P's
blocking receive no longer misreads a stale errno.
A datagram to ourselves goes straight into our own socket's queue, as on
a PSP, so it's there at once through the relay too (net/adhoc/term).
Also from comparing the transports:
- P2P: a blocking Accept of a connection from outside the group keeps
waiting instead of returning -1.
- Relay: an accepted socket gets an id of its own, not its listener's,
which blocking calls are told apart by.
- ALERT in PollSocket comes from the socket in both transports.
- No send/receive timeouts are set on the game's sockets: all host
sockets are non-blocking, and in relay mode the ids aren't host
sockets at all.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Winsock never makes a socket whose connect failed writable; the failure
shows in select's exception set, with the reason in SO_ERROR. The poll
now checks both, and SO_ERROR on a writable socket too, which is where
other systems put a refusal.
Windows still retries a refused connect for about a second before
reporting it, far longer than a PSP at the tests' 800% speed, so
pair/basic is a known P2P failure on Windows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A connect PtpOpen started counted as up as soon as getpeername
succeeded, which on Windows happens while it's still in progress, even
one about to be refused. It now needs the socket ready too, and a
pending connect's failure is read from SO_ERROR, the only place Windows
reports it (pspautotests net/adhoc/pair/basic).
- Out of the group, PdpRecv only dropped what its peek saw; on Windows a
peek can fail and leave the next datagram unchecked, so a vanished
client still got the host's data (pair/vanish).
pspautotests: pair/vanish times PTP's failure from when the peer left the
peer list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A connect to a port nobody listens on is refused within a second on a
PSP, and every later connect on that socket is refused too, even once
something listens there (pspautotests net/adhoc/pair/basic,
pair/ptpclose). PPSSPP recreated the socket and tried again until the
game's timeout ran out, to cover a peer that wasn't listening yet.
Dissidia 012 and Fate/Unlimited Codes, named in the old comments, still
get to their matches.
Also set the established time wherever a connection becomes established,
which the timing of a vanished peer's failure counts from.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Out of the group, a PSP's sends reach nobody and nothing reaches it, and
a PTP connection to a peer that has left fails once its retransmits would
have run out. Only the relay transport did this; the P2P one kept sending
over the host's sockets, so neither side ever noticed the other was gone
(pspautotests net/adhoc/pair/vanish).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RelayTransport, with the aemu_postoffice helpers only it uses, goes to
AdhocTransportRelay.cpp, and P2PTransport to AdhocTransportP2P.cpp. The
helpers they share with sceNetAdhoc.cpp are declared in
AdhocTransport.h. Moved as they were.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>