Skip to content

Client authorization is delayed by 0.7 seconds due to frame hook; NetworkIDValidated would provide instant validation #2504

Description

@A1mDev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions