mirror of
https://github.com/tiennm99/noitu.git
synced 2026-10-11 03:13:45 +00:00
A session can tear down between the hub handing a room its seating message and the room goroutine draining it off the queue. Nothing else ever learns that, since leaveRoom only notifies a room the session had already attached to. Left seated as connected, allConnected() could report true and let quick match auto-start a game against a dead socket. handleCreate, handleJoin, handleStartBot and handleResume now check the connection's context and either reopen the grace window the disconnect would have, or cancel the room when there is no lobby left to hold one open. beginGame could also raise the live-game count after the drain decision: an existing lobby's StartGame, and quick match's own auto-start, now refuse with server_restarting once the hub is draining, matching the refusal newRegisteredRoom already gives a brand-new room. Engine.Snapshot() copied the whole move history on every broadcast for two callers that only ever wanted the last move or the played-word set. Engine.LastMove and Engine.UsedWords answer both directly off the engine's own state, State.History is gone, and Standings is only computed once the game is actually over, which is the only time it is meaningful.