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

Update the LoadServerList Transpiler #41

Closed
wants to merge 2 commits into from

Conversation

Xilophor
Copy link
Collaborator

@Xilophor Xilophor commented Feb 6, 2024

Replaces the cached lobby query, which can become out-of-sync with the lobby query used by the LoadServerList method & postfix due to the nature of async methods. This update changes the caching of the lobby query (clone) to a new local variable in the LoadServerList method which stores the lobby query (clone) and can be pulled out when calling the "postfix."

  • Removed the RequestAsync prefix
  • Removed the list of cached query distance & string filters
  • Added cloning & storing of the lobby query in the LoadServerList transpiler
  • Changed the LoadServerList transpiler to be better formatted

Xilophor added 2 commits February 4, 2024 22:16
Originally was for the cached filter, but now that the query is being given directly from the transpiled method, the check can be removed
@legoandmars
Copy link
Collaborator

Looks good at a glance, I'll have to test it in game to make sure all filtering works as intended

@MaxWasUnavailable
Copy link
Owner

Is this up to date with the main repo? I see some removed properties that are in the other PR.

@Xilophor
Copy link
Collaborator Author

Xilophor commented Feb 8, 2024

Is this up to date with the main repo? I see some removed properties that are in the other PR.

It's up to date, this PR removes some of those properties that were only used as a "cache" to keep the query info, but with the updated transpiler those are no longer necessary.

This does still need testing (I'll see if one of y'all are up for it tonight).

Base automatically changed from lobby-filtering to master February 9, 2024 11:18
@Xilophor
Copy link
Collaborator Author

Because of the way async methods work, between "states", or await calls, and variables that are carried between them have to be stored in the instance of the compiler-generated class. The compiler will automatically generate these "state" fields only for variables used by multiple states.

There lies the issue, the lobby query local variable is not used by multiple states, so the compiler does not store the value in a "state" field. Therefore, the local variable is not saved between states, and is null when we attempt to pull it out in the post-fix.

The three solutions available are what we currently have, preload-patching the method, or an "in-between" solution, where we store the lobby query variable in a dictionary of the async class instance and the LobbyQuery struct.

For now I'm closing this PR as the method we have works, even if there are very unlikely edge-cases. We can come back and implement either the in-between solution or the preload-patcher solution, sometime after initial release.

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.

3 participants