Skip to content

fix(match): kick refused clients with a reason instead of an empty ticket - #359

Closed
Flegma wants to merge 1 commit into
mainfrom
fix/match-refused-kick-reason
Closed

Flegma wants to merge 1 commit into
mainfrom
fix/match-refused-kick-reason

Conversation

@Flegma

@Flegma Flegma commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

A client the match connect hook refuses on a server without a password is let in and kicked with a reason at connect full, instead of getting an empty Steam ticket that loops it on reconnect.

  • The refusal is recorded only when the engine does not already refuse it by password, keyed by the claimed id (SteamID reads 0 on SwiftlyS2 before Steam verifies), and all marks clear on map start so a spoofed connect cannot kick a player already on the server.
  • New player.join.refused line in every language.
  • CounterStrikeSharp cannot put a reason on a kick: the client is moved to spectators, shown the reason, and kicked 4 s later if still connected and still refused.
  • Same change for player management is in fix(player-management): kick refused players with a reason instead of the empty ticket loop #358; the two are independent.

Tested: apps/swiftly/test (1533 passed), apps/counterstrikesharp/test (1301 passed).

…cket

Without a usable sv_password the match connect hook stripped the Steam ticket, which loops the client on reconnect. The client is now let in, the refusal is remembered by the id it claimed, and it is kicked at connect full with the reason (CounterStrikeSharp: spectator, chat and center message, kick after 4 s). Marks are only kept when the engine does not refuse by password and are cleared on map start. The password path is unchanged.
@lukepolo

Copy link
Copy Markdown
Contributor

Closing. On a server with sv_password set the hook passes the engine the same arguments as main, and match pods always launch with one. So the new path only runs on a dedicated server before its first match setup, or on an offline pod before setup. That window isn't worth the new state:

  • The refused kick runs at connect full before the current-map check, but _refusedKicks.Remove comes after PlayerDisconnected's currentMap == null return. A client refused while the match has no current map leaves a stale entry.
    • CSS then kicks that id at its next connect full, even when it's authorized on a password server (now a caster or a lineup member).
    • Swiftly treats that player's next real disconnect as a kick: no unready, no roster pause, no abandon timer.
  • CSS gives a refused client 4 s as a live spectator, and they can repeat it by reconnecting.
  • A forged connect that arrives after the map-start Clear() and before a caster's connect full still gets the caster kicked.

#358 is where a passwordless server is the normal case, so it needs its own look.

@lukepolo lukepolo closed this Nov 24, 2026
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.

2 participants