Description
The current implementation of client authorization in SourceMod relies on a periodic check in RunFrameHooks() that runs every 0.7 seconds. This introduces an unnecessary delay before OnClientAuthorized is called, which can be problematic for plugins that need to act on a player's Steam ID as soon as possible.
In contrast, the Source engine itself provides a much more immediate callback: IServerPluginCallbacks::NetworkIDValidated or IServerGameClients::NetworkIDValidated This function is invoked by the engine as soon as Steam confirms the client's ticket (upon receiving ValidateAuthTicketResponse_t), guaranteeing that the client is authorized.
Problem
- Using the 0.7-second frame hook means
OnClientAuthorized can be delayed up to 700ms.
- This delay is noticeable and can lead to race conditions for plugins that rely on immediate Steam ID validation (e.g., for group checks, stats requests, or fast-kicking cheaters).
- It is especially impactful on servers with fast SSDs where the client can be fully loaded well before this check occurs.
Proposed Solution
Add a forward that is triggered directly by the NetworkIDValidated callback. This would allow plugins to act on authorization events instantly, without the artificial delay.
Alternatively, make this mechanism configurable (e.g., via a cvar) to allow server operators to choose between the current behavior and the immediate callback.
Additional Context
Possible Risks
NetworkIDValidated behavior may vary slightly across different engine branches.
- A migration path would be needed to avoid breaking existing plugins that rely on the current timing.
Description
The current implementation of client authorization in SourceMod relies on a periodic check in
RunFrameHooks()that runs every 0.7 seconds. This introduces an unnecessary delay beforeOnClientAuthorizedis called, which can be problematic for plugins that need to act on a player's Steam ID as soon as possible.In contrast, the Source engine itself provides a much more immediate callback:
IServerPluginCallbacks::NetworkIDValidatedorIServerGameClients::NetworkIDValidatedThis function is invoked by the engine as soon as Steam confirms the client's ticket (upon receivingValidateAuthTicketResponse_t), guaranteeing that the client is authorized.Problem
OnClientAuthorizedcan be delayed up to 700ms.Proposed Solution
Add a forward that is triggered directly by the
NetworkIDValidatedcallback. This would allow plugins to act on authorization events instantly, without the artificial delay.Alternatively, make this mechanism configurable (e.g., via a cvar) to allow server operators to choose between the current behavior and the immediate callback.
Additional Context
OnClientAuthorizedis documented as being called "when a player gets a Steam ID", but the delay makes it less reliable for time-sensitive operations.OnClientNetworkIDValidatedor to remove the 0.7-second delay entirely.Possible Risks
NetworkIDValidatedbehavior may vary slightly across different engine branches.