net: fix Windows MSG_PEEK/MSG_WAITALL receives and preserve socket modes #1174
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1174
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1174/head"
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?
@theantipopau on GitHub · 2026-10-08 00:01 UTC · original
theantipopau:net-win-recv→main· +216 −15 · 2 files · 1 commits · closed without mergingSummary
Windows guest networking fixes found while running real PS5 dumps on our fork:
MSG_PEEK|MSG_WAITALL→WSAEOPNOTSUPP. Winsock rejects the combined flag on connectionless sockets even though a datagram is delivered whole (proven with a standalone probe: len=0MSG_PEEKworks,MSG_PEEK|MSG_WAITALL→ 10045). Stream sockets keep the combined flag; datagram receives stripMSG_WAITALL.accept()the way FreeBSD inheritsO_NONBLOCK, keeping native and guest bookkeeping in agreement.WAITALLreceive and end-of-file short reads complete correctly.Test coverage (
tests/KernelFileSystemTests.cpp)PEEK|WAITALLreceive, peeked bytes stay available afterwardsMSG_DONTWAITreturns the buffered prefix without waiting, thenEWOULDBLOCKon emptyPEEK|WAITALLreceivesSDL_MAIN_HANDLEDso the Windows entry point is not renamed — the same two lines as #948; identical additions, so merge order between the two PRs does not matter.Verification (Windows x64, local)
alltarget).kernel_file_system_testsfresh binaries:upstream/main+ this branch: reaches and fails only at upstream's own new datagram check "Net unknown socket options return protocol-option errors" — the WindowsENOPROTOOPTgap fixed by #1159, unrelated to this change.f5d8d52aapplied on top:KernelFileSystemTests: all cases passed.Notes for maintainers
kernel_file_systemis not in.github/workflows/build.yml's ctest-Rsubsets on any platform, so none of this runs in CI today. Recommend adding it to the workflow once #1159 lands (otherwise the Windows job fails on theENOPROTOOPTgap).@coderabbitai[bot] on GitHub · 2026-10-08 00:05 UTC · original
📝 Walkthrough
Walkthrough
The network layer now tracks Windows guest blocking mode and applies the listener’s mode to accepted sockets. Stream receives retain
MSG_WAITALL, while datagram receives clear it. The tests cover fragmented and nonblocking TCP receives, EOF behavior, accepted-socket mode, and zero-length UDP datagrams.Suggested reviewers:
nmzikPriority: ⬇️ Low
Change: Bug fix
Merge Risk: 🔵 Low · up to
47ad3The change fixes Windows peek and wait-all receives and preserves socket modes. One new accepted-socket test may abort on a valid would-block result. That is a bounded, test-only risk worth fixing before merge.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@ -1377,0 +1498,4 @@inherited_consumed += static_cast<size_t>(inherited_chunk);continue;}Check(inherited_chunk == -1 && *net_errno == Libs::Posix::POSIX_EWOULDBLOCK,@coderabbitai[bot] on GitHub · 2026-10-08 00:05 UTC · original
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Check the errno set by
Net::Recv.If the suffix has not arrived, this nonblocking
Net::Recvcan return would-block. The assertion then readsnet_errno, which belongs to the separate Net ABI path and still holdsPOSIX_EINVAL. The test aborts instead of retrying. Check*Libs::Posix::GetErrorAddr()here. (learn.microsoft.com)@coderabbitai[bot] on GitHub · 2026-10-08 00:05 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
9a39c2ea-b53f-449a-a0cc-1d950e681ec5📥 Commits
Reviewing files that changed from the base of the PR and between
5a8808086aand47ad391f8e.📒 Files selected for processing (2)
src/libs/network.cpptests/KernelFileSystemTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
Pull request closed