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)