test(net): reset the closed peer with unread data so the send fails at once #2295

Merged
parl0v merged 1 commit from upstream-pr/2295 into main 2026-10-09 21:47:13 +00:00
parl0v commented 2026-10-09 14:55:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-09T14:55:05Z.


What

guest_sce_net checks that a send fails once the peer has closed its socket. It closes the accepted socket after a clean exchange and gives the client 100 sends, 1 ms apart, to see the failure. That relies on the peer's RST arriving within ~100 ms. On a Windows host with a WFP network filter installed (Cloudflare WARP and ProtonVPN here), the client's sends keep succeeding for ~19 s: 1213 to 1214 tries in 3 of 3 runs, past the 100-try loop, so the test aborts at Require(send_failed). A plain Winsock program with the same sequence and no AnyPS5 code does the same (1205 to 1207 tries, ~19 s, then WSAECONNABORTED), so it is the host, not libSceNet.

Before closing the accepted socket, the client now sends one more message, and the test waits on the existing epoll until the accepted socket has it. Closing a TCP socket with unread received data sends a RST at once (RFC 2525 2.17, and what Windows, Linux and FreeBSD do), so the next send fails on the first try whatever filter is installed. The check is unchanged: a send to a reset peer fails.

In the plain Winsock program, closing with unread data made the next send fail on try 1 in 5 of 5 runs (WSAECONNRESET).

Tested

Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, BUILD_TESTING=ON, RTX 4060, on d70b8998.

  • guest_sce_net: failed on every run before; --repeat until-fail:10 passes after.
  • Full ctest: 507/507 passed (1 skipped by design).
  • tools/check_conventions.py --base origin/main passes.

Checklist

  • Based on current main; no other open PR implements the same change
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4802097856 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2295). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-09T14:55:05Z. --- ### What `guest_sce_net` checks that a send fails once the peer has closed its socket. It closes the accepted socket after a clean exchange and gives the client 100 sends, 1 ms apart, to see the failure. That relies on the peer's RST arriving within ~100 ms. On a Windows host with a WFP network filter installed (Cloudflare WARP and ProtonVPN here), the client's sends keep succeeding for ~19 s: 1213 to 1214 tries in 3 of 3 runs, past the 100-try loop, so the test aborts at `Require(send_failed)`. A plain Winsock program with the same sequence and no AnyPS5 code does the same (1205 to 1207 tries, ~19 s, then `WSAECONNABORTED`), so it is the host, not libSceNet. Before closing the accepted socket, the client now sends one more message, and the test waits on the existing epoll until the accepted socket has it. Closing a TCP socket with unread received data sends a RST at once (RFC 2525 2.17, and what Windows, Linux and FreeBSD do), so the next send fails on the first try whatever filter is installed. The check is unchanged: a send to a reset peer fails. In the plain Winsock program, closing with unread data made the next send fail on try 1 in 5 of 5 runs (`WSAECONNRESET`). ### Tested Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, `BUILD_TESTING=ON`, RTX 4060, on d70b8998. - `guest_sce_net`: failed on every run before; `--repeat until-fail:10` passes after. - Full `ctest`: 507/507 passed (1 skipped by design). - `tools/check_conventions.py --base origin/main` passes. ### Checklist - [x] Based on current `main`; no other open PR implements the same change - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!2295
No description provided.