From 2789a82ef4e6ff29e0cda2a716611e68038bdc70 Mon Sep 17 00:00:00 2001 From: donnyjang Date: Thu, 15 Oct 2026 23:26:39 -0700 Subject: [PATCH] contract: the probe hosts above the OS dynamic port range (27961) The probe's rooms sat on 7961-8071, inside this machine's dynamic port range (1024-15000). A probe client that drew the next room's port as its source port made that room's bind fail: the server printed "0" and the probe died with "ended before it listened", on most runs. --port still overrides. Co-Authored-By: Claude Fable 5.1 --- contract/probe-feature-messages.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/contract/probe-feature-messages.py b/contract/probe-feature-messages.py index 6d2deb9..8da8a6d 100644 --- a/contract/probe-feature-messages.py +++ b/contract/probe-feature-messages.py @@ -18,7 +18,7 @@ # python Tools/YGOLegacy/probe-feature-messages.py --dll # hosts its own lobby from that DLL (cwd must be the repo root, like # BotArena: the DLL reads ./expansions and friends) on --port (default -# 7961) and stops it at the end. This is how a freshly built, not yet +# 27961) and stops it at the end. This is how a freshly built, not yet # installed DLL is probed. # # With --dll it then gates patch 0009 (TICKET-258, setup pairs): it hosts five @@ -307,7 +307,7 @@ def host_dll(path, port, mode=0, tail=""): deadline = time.time() + 20 while time.time() < deadline: if not t.is_alive(): - sys.exit("ygoserver thread ended before it listened (cwd must be the repo root; port %d free?)" % port) + sys.exit("ygoserver thread ended before it listened (cwd must be the repo root; port %d free? a port inside the OS dynamic range collides with the probe's own connections)" % port) try: socket.create_connection(("127.0.0.1", port), timeout=0.3).close() return dll, t @@ -322,7 +322,10 @@ def main(): ap.add_argument("--port", type=int, default=None) ap.add_argument("--dll", default=None, help="host a lobby from this ygoserver.dll instead of connecting to one") o = ap.parse_args() - port = o.port or (7961 if o.dll else 7911) + # Above every OS dynamic (ephemeral) port range: this machine hands outgoing connections ports + # 1024-15000 (netsh int ipv4 show dynamicport tcp), and a probe client that drew the next room's + # port made that room's bind fail ("0", then "ended before it listened") on most runs. + port = o.port or (27961 if o.dll else 7911) feature_suite(o, port) if o.dll: setup_suite(o.dll, port + 1)