Files
Michess/server
Michess bbf26826c6 fix: call leaveLobby before setting connected=true in joinLobby
Previously leaveLobby was called after game.black/white.connected was set
to true. Because every logged-in socket is in a personal user:{id} room,
this.rooms.size was always >=2, so leaveLobby fired on every join and
immediately found the *new* game via the connected-flag check, resetting
connected=false. This prevented the bot-trigger and clock-start checks from
passing, so bot-as-white tournament games never made their first move.

Fix: move leaveLobby call to before the connection-state assignment so it
can only find a genuinely *previous* game (where connected was already true
from an earlier join).

Closes #4

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 12:54:08 +02:00
..
2023-07-27 15:02:34 +08:00