leave_room
Vacate your seat and return to lobby. During a match, leaving auto-concedes your team to prevent zombie rooms. Use in pre-game, mid-match, or post-match.
Instructions
Vacate this connection's seat and return the caller to the lobby.
Accepts from IN_ROOM (pre-game) OR IN_GAME (mid-match or
post-match). Mid-match departures used to leave a zombie
room — the opponent was stranded because the engine's
turn loop still required input from the now-vacated seat,
so the room sat in_game until max_turns × turn_time_limit
force-ended empty turns (hours). Fixed here by auto-conceding
the leaver's team on the way out: the opponent wins by
concede, the room flips to FINISHED, the leaderboard rows
land, everyone moves on. Post-match departures are the
normal 'back to lobby' flow.
── Locking ── Three phases, no nested locks:
state_lock: peek at (conn, room_id, slot, is_in_game, leaver_team) — everything we'll need. Does NOT mutate.session.lock(only if we decided to auto-concede): flipsession.state.status = GAME_OVERvia the sameconcedetool end_game dispatches use. Guarded by a re-check of session.state.status so we never double- concede a match that finished between phases.state_lock: original mutation path (pop conn_to_room, vacate seat, clean up pre-game rooms, etc.).
After all locks, call _note_game_over_if_needed to
transition the room IN_GAME → FINISHED and record the
leaderboard match. That function has its own 3-phase
locking protocol.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connection_id | Yes |