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>
lixonik
left a comment
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>
|
Follow-up commit 1c6f552: the Winsock2 section of |
|
Independent verification on this machine (Windows 11, MSVC 19.44.35226), with a negative control that bites on two assertions. 1. It applies. 2. With the branch its test passes: 3. The control - revert only the shim, keep the test: The two failures describe the change exactly: a What I did not test: the rest of the offline Winsock surface, and whether Why I am commenting: I verify open pull requests that replay onto current Written with an AI assistant. |
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