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 <noreply@anthropic.com>
This commit is contained in:
donnyandClaude Fable 5.1 committed 2026-10-15 23:26:39 -07:00
1 parent 2344e5dae1
commit 2789a82ef4
1 file changed
+6 -3
+6 -3
View File
@@ -18,7 +18,7 @@
# python Tools/YGOLegacy/probe-feature-messages.py --dll <path\to\ygoserver.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)