Skip to content

bug: stop stacked leaver bans and missed auto-resume on reconnect - #184

Merged
lukepolo merged 1 commit into
mainfrom
fix/leaver-bans-and-reconnect-resume
Sep 18, 2026
Merged

lukepolo merged 1 commit into
mainfrom
fix/leaver-bans-and-reconnect-resume

Conversation

@lukepolo

Copy link
Copy Markdown
Contributor

Both fixes are applied to both runtimes (counterstrikesharp and swiftly).

Stacked leaver bans
One leave could be reported as several abandons, and the api escalates the cooldown on every report:

  • a player who disconnects past the timeout, reconnects, then disconnects again was reported twice;
  • SurrenderSystem.Reset() runs per map, so each map of a series could report the same player again;
  • SetupDisconnectTimer overwrote a stored timer without killing it, leaving an orphan that CancelDisconnectTimer could never reach and that fired its own abandon.

Reports are now deduplicated per match (the set survives the per-map reset and is cleared only when a different match loads), and any existing timer for a steam id is killed before a new one is stored, across every team bucket.

The api side is covered separately by a unique constraint in 5stackgg/api#409.

Match stayed paused after a reconnect
player_connect_full fires before the connecting client is on the runtime's player list, so the roster count came up one short and the auto-resume was skipped. The check now runs a frame/tick later. It also counted every player on the server, so a caster or an admin could satisfy it while a player was still missing; it counts roster players now. Tactical and technical pauses are still left to the teams.

Tests: 57 (css) and 106 (swiftly), each +3 for the extracted roster-count helper. SurrenderSystem itself is not reachable from the test projects — it takes live CS2 state — so that half is verified by build only.

- one leave could be reported as several abandons (after a reconnect, and
  again on each map of a series), and the api escalates the ban per report
- SetupDisconnectTimer overwrote a live timer without killing it, leaving an
  orphan that fired its own abandon
- player_connect_full runs before the connecting player is on the runtime's
  player list, so the auto-resume check came up a man short and the match
  stayed paused until someone typed .resume
- the resume check counted everyone on the server, so a caster or admin could
  satisfy it while a player was still missing
@lukepolo
lukepolo merged commit ee33578 into main Sep 18, 2026
3 checks passed
@lukepolo
lukepolo deleted the fix/leaver-bans-and-reconnect-resume branch September 18, 2026 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant