mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:45:53 +01:00
[PR #2241] ws2_offline: let connect dissolve a UDP association (WS2-UDP-DISCONNECT) #2245
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2245
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2241
Author: @syfyra
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/ws2-udp-disconnect📝 Commits (2)
55dfd6bws2_offline: let connect dissolve a UDP association (WS2-UDP-DISCONNECT)1c6f552docs: runtime_imports describes the WS2-UDP-DISCONNECT behaviour📊 Changes
3 files changed (+126 additions, -4 deletions)
View changed files
📝
docs/runtime_imports.md(+7 -2)📝
runtime/shims/ws2_offline.cpp(+26 -2)📝
runtime/test/ws2_offline_test.cpp(+93 -0)📄 Description
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 #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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.