-
Notifications
You must be signed in to change notification settings - Fork 505
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
Never permit of using [unassigned] value in SetPersonaState() + deterministic name #443
Conversation
The biggest advantage of this is fixing two outstanding issues I have with current implementation:
If I didn't miss any use case of those two fields, this is a breaking change as default value of uninitialized user has changed, but I think it's justified if we're able to fix both points above while not generating any major regressions in internal SK2 code. While I can verify fixes, I hope you can help me with SK2 internals knowledge. It looks good to me, but I don't know private SK2 code that good. |
I was thinking more along the lines of omitting We have I'm assuming though that Steam can handle only one of the two fields being set... I'll have to have a look at how Steam handles it and at what point in the application lifecycle it calls |
If you confirm that we can omit it then we can get rid of that ugly exception as well as that name variable in the request itself. This is even more satisfying than current solution, let me know about your results. Still, I vouch for setting name initially to |
Steam's behaviour is as I remember it:
For a more practical approach, rather than an analytic one, I just tested with SteamKit and if you send On the flip side, if you omit |
Now the only question is if something explicitly depends on default value of account's name. I bet not in SK2 internals, since otherwise it should be marked with I love how we could get rid of that exception and just avoid setting name entirely 👍. |
This means now that |
Correct, I improved docs a little with this detail, not sure if we can do anything more in terms of this, apart from stating breaking change in the release changelog. I thought of making those methods deprecated at first with something like |
@@ -57,7 +57,7 @@ internal SteamFriends() | |||
|
|||
|
|||
/// <summary> | |||
/// Gets the local user's persona name. | |||
/// Gets the local user's persona name. Can be null before user's initialization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to do a better job of defining exactly when the local user's persona name will be available. Might have to dig into the disassembly again to see exactly how steamclient handles this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to update PR with a better explanation if appropriate - GitHub recently added a way for repo maintainers to update PRs if contributor enables such option 🙂.
I like the idea of excluding the local name in |
The local user's name is available after
Therefore, code which handles the account info msg or code which handles the account info callback could have the local user name set, or could not. It's one big fat race condition. For code which handles subsequent messages/callbacks, the local user name should always be available. |
It's also important to remember that Steam might not always send callbacks in appropriate order, so we might receive It's fine to say that local user's name will be available after receiving |
Or just use a |
How about now? It looks enough documented to me. |
Could do with some grammatical tweaks,:
I'd also remove the initialisation descriptions from Friend and Clan. We go from knowing nothing about them to knowing the exist, and Steam provides us with the name at that point in time (though it's not guaranteed to do so - protocol could change). The old xmldoc is probably sufficient for these two, and we can use the release notes to announce that they could potentially be null in a severe edge case. |
I think this should work now. Apart from docs suggestions I changed internal implementation of handlers to ordered dictionary, so SK2 handlers are always first (in our fixed order), and then user handlers are executed last. I also changed order of SteamUser -> SteamFriends to SteamFriends -> SteamUser during initialization, I stopped for a second wondering if old order was supposed to mean anything, but then, previous dictionary had unpredictable order anyway, so it should not. I checked if all tests were passing after doing this change, looks good to me. |
As of now I think this PR is in good state to be merged, unless somebody has something else to add. We could in the future improve handlers and their order, but even current solution is good enough and doesn't result in worse overall health condition than previous one, in fact, it fixes things the way they should be fixed to begin with. |
I'm happy with this. @voided? |
I fixed this as part of SteamRE/SteamKit#443
Please review the changes carefully, this can cause serious regressions if I didn't catch some common-use scenario.
Rationale: #442