Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't recalculate Steam ID every frame when waiting for validated auth. #222

Merged
merged 3 commits into from Dec 18, 2014

Conversation

psychonic
Copy link
Member

Right now, RunAuthChecks runs every frame and calls UpdateAuthId for each player that isn't validated yet. This PR skips the Steam ID calculation part of UpdateAuthId if the auth id hasn't changed since the last run.

@psychonic
Copy link
Member Author

I made another change unrelated to this issue, but related to auth. It seems fitting here rather than to touch some of the same code in another new branch.

This was pointed out by @KyleSanderson:
GetClientAuthString has long (forever?) worked before a client was authorized if the validate param is set to false (or before it existed). This also became true for the newer GetClientAuthId. As soon as the first auth queue check was done, one frame after ClientConnect, the data was available. GetPlayerAccountId, however, previously worked immediately in OnClientConnect if validate was false. This broke when refactoring auth logic.

This latest commit makes all of these work as early as in OnClientConnect (again, if the call doesn't require the auth id to be validated).

@@ -405,7 +405,7 @@ void PlayerManager::RunAuthChecks()
pPlayer = &m_Players[m_AuthQueue[i]];
pPlayer->UpdateAuthIds();

authstr = pPlayer->m_AuthID.c_str();
authstr = pPlayer->m_AuthID.chars();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I question the placement of this with 410 below it.

@KyleSanderson
Copy link
Member

Overall this looks good, the behaviour change will eliminate the need for people hooking player_connect and other grotesque non-portable things.

Maybe the authid should be compared instead of the string every frame? With how it was though, this is still better 👻.

:shipit:

@psychonic
Copy link
Member Author

Hokay, I think we've sorted all of this out on irc.

I question the placement of this with 410 below it.

It is intentional to cache these as soon as we have them, rather than to do the old style of grabbing on the fly if not cached.

Maybe the authid should be compared instead of the string every frame? With how it was though, this is still better 👻.

To do that would require a duplication of logic and not overall be much of an optimization after you call a couple of extra vfuncs, add a few compares, etc.

psychonic added a commit that referenced this pull request Dec 18, 2014
Don't recalculate Steam ID every frame when waiting for validated auth.
@psychonic psychonic merged commit 7304747 into master Dec 18, 2014
@KyleSanderson KyleSanderson deleted the auth-ogrekill branch September 8, 2015 01:47
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.

None yet

2 participants