Repository navigation
Conversation
connect's remarks: on a connectionless socket, connecting to an all-zero address dissolves the association, after which send and recv fail with WSAENOTCONN. connect and WSAConnect refused that address as a non-loopback destination (WSAENETUNREACH), so a datagram socket stayed tied to its first peer for good: datagrams from any other address were still dropped. Windows 11 dissolves the association for 0.0.0.0:0, [::]:0 and an AF_UNSPEC address and refuses 0.0.0.0 with a port (WSAEADDRNOTAVAIL); a TCP socket refuses all of them. None reaches a peer, so those forms now go to the host; 0.0.0.0 with a port stays refused before it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 4 tasks
lixonik
reviewed
Nov 26, 2026
lixonik
left a comment
Contributor
There was a problem hiding this comment.
Built ws2_offline_test at this head with MSVC on Windows 11. CTest passed with 83 checks and zero failures, including the new UDP association teardown and reconnect coverage. No findings from these checks.
AI-assisted.
The Winsock2 section still described the shim before this change; it now names the new behaviour and the test that covers it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Follow-up commit 1c6f552: the Winsock2 section of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: WS2-UDP-DISCONNECT (claim comment to follow)
What and why
runtime/shims/ws2_offline.cppletsconnectandWSAConnectthrough only for loopback addresses and fails everything else withWSAENETUNREACH. connect's remarks give an all-zero address a second meaning on a connectionless socket: it dissolves the association, after whichsend/recvfail withWSAENOTCONNand datagrams from any address arrive again. The shim refused that address like any external one, so a UDP socket connected once to a loopback peer stayed tied to it: the title's disconnect failed, and datagrams from every other loopback port kept being dropped.Measured with a small probe on Windows 11 (loopback only):
connect(0.0.0.0:0)0, association gone (getpeername→WSAENOTCONN)WSAEADDRNOTAVAILconnect([::]:0)(IPv6 socket)0, association goneWSAEADDRNOTAVAIL([::]:80)connect(AF_UNSPEC)0, association goneWSAEAFNOSUPPORTWSAConnect(0.0.0.0:0)0, association goneconnect(0.0.0.0:4321)WSAEADDRNOTAVAIL, still connectedWSAEADDRNOTAVAILNone of these reaches a peer.
connectandWSAConnectnow pass the disconnect forms (anAF_UNSPECaddress, and0.0.0.0or::with port 0) to the host.0.0.0.0with a port stays refused before the host, as before.Tested
Windows 11, MSVC 14.44 (Build Tools), RelWithDebInfo:
ws2_offline_testgets a section 5b: a loopback UDP socket connected to A is disconnected withconnect(0.0.0.0:0), after whichgetpeernameandsendfail withWSAENOTCONNand a datagram from a second socket B arrives; the same throughWSAConnectand with anAF_UNSPECaddress and, on an IPv6 socket, with[::]:0.0.0.0.0:4321stays refused withWSAENETUNREACH, and on a TCP socket both forms fail with the host's error.main: 9 of the 12 new checks fail.ctest -j 8over the 168 CPU tests, with this branch and WS2-CONNECT-BY-NAME-V6 merged: all pass exceptxmem_no_write_watch, whose split-reader check is the start race runtime tests: race a reader thread only once it reads (RT-TESTS-READER-START) #2131 fixes (it passes on its own).scripts/check_no_game_data.pyon both files.Not tested under Wine.
This and WS2-CONNECT-BY-NAME-V6 both change
ws2_offline.cppand its test, in different places; they merge cleanly in either order.GPUs tested: n/a (CPU tests)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code