fix(net): implement SO_ERROR for connection completion #2182
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2182"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by RockYou-cmd on 2026-10-09T10:48:59Z.
What
sceNetGetsockoptrejects SO_ERROR, so a caller waiting for a nonblocking connection cannot query its completion result. Implement guest SO_ERROR (0x1007), translate the host socket error to guest errno, return the output size, and preserve thread errno on successful queries.On Windows 10 build 19045.7417, Winsock returns WSAECONNREFUSED repeatedly after a failed asynchronous connection. Track the consumed completion error per native socket, serialize connect/error queries, and reset it when another connection attempt starts. Successful connections stop this tracking once getpeername confirms a peer. Established-socket and UDP errors continue to use host behaviour.
The regression covers successful and refused loopback connections, invalid query arguments, output bounds, errno preservation, receive EAGAIN, and Windows same-socket retries with concurrent readers. The pending-connect errno mapping is already provided by merged #1448 and is not reintroduced here. FreeBSD-derived guest behaviour and unverified console semantics are recorded in TechnicalDebt.
Overlap review: 456 open PR titles/bodies checked, with diffs inspected for the open libSceNet changes. #1786 extends the same host-error mapping and #1588 changes the global synchronization used by the same exports; neither implements SO_ERROR. Resolver and pool-statistics changes have since merged and are preserved in the final rebase. No dependency on an unmerged PR.
Tested
Candidate Windows validation and final rebase:
f145139676a48306681d3a4d5fabf83938759daf: both networking targets compiled andguest_sce_netplusguest_sce_net_connecteach passed three CTest repetitions (six executions, 0 failures, 12.85 seconds). This uses the project guest ABI.51f69aa2182f28ef3b91cdc20e57431d065e3e65preserves the same SO_ERROR implementation and tests, incorporates upstream resolver/pool-statistics changes, and resolves the TechnicalDebt conflict while retaining upstream entries. The macOS isolated loopback regression passed after this rebase. Windows/Linux integration on this final base remains pending maintainer-triggered CI; the earlier Windows run is not presented as a final-head result. Upstream Build run 37919912528 is action_required with no jobs started. The conventions check passed.b7a6823f. Diff and repository conventions checks passed.Earlier Windows validation on
df16c4c256be3c44e03eb9149a6ce5f8e8a038b2, before narrowing the patch for current main:guest_sce_netand newguest_sce_net_connectpassed three repetitions, including Windows refusal clearing, concurrent readers and successful same-socket retry.agc_driver_sdwa_float_selectors,agc_driver_sdwa_ldexp_f16, andguest_system_fontfailed. Temporarily removing the patch and rebuilding reproduced all three failures on the same upstream revision and machine. The two graphics mismatch values were identical; the font test ended at the same point in its output. Restoring the patch and rebuilding made both networking tests pass again.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T11:28:30Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/TechnicalDebt.mdL367docs/dev/TechnicalDebt.mdL367docs/dev/TechnicalDebt.mdL367Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T20:09:43Z.
Closing: no title is shown querying
SO_ERRORthroughsceNetGetsockopton main, and the Winsock error tracking is a lot to carry without one. If a title needs it, please reopen.Pull request closed