N8: Keep connections serviced while islands are made, and stop servers gracefully
The soak's drops under loss came from stalls: the server's island (#79) and each client process making islands on its main thread fed ENet second-long round-trip samples, its retransmission timer grew, and two losses of one reliable message in the busy drop that followed reached the 15 s timeout. - ClientGame.build_in_background makes a new match's island on a WorkerThreadPool task and holds the packets that arrive meanwhile, then takes them in order. The networked client and the soak's clients use it; the soak's own one-island-a-frame holding is gone. - NetServer.close(grace_msec) sends the shutdown notice reliably and services the socket while clients acknowledge it. The headless server waits up to 2 s. A notice sent once was lost under 2% loss, and that client timed out instead of hearing the server stop. - Tests: background island holding and ordering, freeing mid-build, a graceful shutdown reaching four clients behind 50% loss (it fails with the old one-shot notice), and the scripted UDP match and client capture wait for the client's island the way a real 20 s lobby would. The soak at 2% loss and +/-20 ms now keeps all 24 clients for both matches, with 0 of 3,758 world hashes differing and every client told of the stop. It still fails on client memory growth between matches in two of three processes (17 and 20 MB), which is not yet explained, so #39 stays open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -118,6 +118,12 @@ func test_a_scripted_client_plays_a_whole_match_on_a_real_server() -> void:
|
||||
# agree however fast this machine is.
|
||||
while Time.get_ticks_msec() - started < 240000 and not session.phases.has(Match.RESULTS):
|
||||
game.poll()
|
||||
if session.game.building_world():
|
||||
# The island is made in the background. A real lobby lasts 20 s, far
|
||||
# longer than that takes; this one is 10 ticks, so the server waits.
|
||||
session.pump(DT)
|
||||
OS.delay_msec(5)
|
||||
continue
|
||||
loop.run_tick()
|
||||
game.after_tick()
|
||||
session.pump(DT)
|
||||
|
||||
Reference in New Issue
Block a user