Lobby: re-assert ready at most once a second (no lobby_update storm)

The waiting-room pump sent set_ready every frame while the local seat was
not yet echoed as ready. Each set_ready is a lobby_update broadcast to the
whole room, so two waiting peers produced hundreds of updates; the host then
missed the seat update (seat 2 shown open, Start disabled) and, after Start,
the launch itself. Offer changes still go out immediately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shokunin
2026-10-09 21:07:08 -07:00
parent d9ea46249f
commit 2943e50cb1
+11 -1
View File
@@ -13906,7 +13906,17 @@ namespace {
(!s_last_mc.valid || mc->has_card != s_last_mc.has_card ||
mc->share != s_last_mc.share)) ||
mod_offer_changed;
if (!psx_lobby_local_ready() || offer_changed) {
/* Re-assert ready at most once a second. This ran every frame
* until the server's echo arrived: each set_ready is a
* lobby_update broadcast to every seat, so two peers waiting on
* each other produced a storm that overran the server's
* per-connection queue -- the host then missed the seat update
* (seat 2 shown open, Start disabled) and even the launch. */
static uint32_t s_ready_sent_ms;
const uint32_t now_ms = SDL_GetTicks();
if (offer_changed ||
(!psx_lobby_local_ready() && now_ms - s_ready_sent_ms >= 1000u)) {
s_ready_sent_ms = now_ms;
(void)psx_lobby_set_ready(1);
if (cur) s_last_offer = *cur;
if (mc) s_last_mc = *mc;