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

Improve Layer finding #314

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

steelskillet
Copy link
Contributor

Goal: Currently the RCON overrides any layer found by the log parser. RCON fails to find the correct layer more often and provides not up to update information on the current layer. These changes prioritize Layer updating in order of accuracy and adds using the layer information from the the A2S query (which gives layer id as opposed to RCON which gives layer name).

Idea: Basic idea of the logic is that if the current layer in this.currentLayer gives the same information that is given from the squad server (for either A2S or RCON) then it should not update the current layer to whatever it would possibly find (either no layer or an incorrect layer).

Special Considerations: This code also takes into account a race condition with the log parser in which if we start the RCON/A2S query then compare to the current layer data, it's possible that the log parser changed the current layer data after the squad server gave the information to the query but before that query returned in squadjs. Does this by pulling the current layer data before initiating the query.

Simpler logic could not be used (eg if (this.currentLayer == null) update layer) in the rare case that we lose the log parser (eg the log parser is on ftp or similar).

Testing: Currently not tested and needs sanity checking (I use different logic for my squadJS at the moment, will be copying this in and testing shortly).

@werewolfboy13
Copy link
Collaborator

Recommended here is RCON first as it is more reliable and will have to be the focus for changes to Squad that are planned down the road. I'd rather keep it RCON first if that is the current method.

@steelskillet
Copy link
Contributor Author

steelskillet commented Nov 3, 2023

Current method is if either the NEW_GAME or updateLayerInformation events run they unconditionally set this.currentLayer to whatever they think the layer is or isn't, it just so happens that the RCON based updateLayerInformation gets called periodically and thus destroys any information that the log parser may have found, even when the RCON doesn't find the layer it overwrites it with null. The log parser has a higher chance of finding the correct layer because it uses the layer id rather than the layer name.
With this as well, the current information is essentially double checked by RCON and if found incorrect then RCON will update it if it finds 'better' information.
A2S works the same way and is given equal priority with regards to RCON however has a higher chance of finding a correct layer due to reporting layer id rather than layer name (it also required minimal changes).
It's more along the lines of if one of the queries finds bad information then it shouldn't overwrite what's already there.

@werewolfboy13
Copy link
Collaborator

Testing: Currently not tested and needs sanity checking (I use different logic for my squadJS at the moment, will be copying this in and testing shortly).

This will need public testing before I can push anything through.

@steelskillet
Copy link
Contributor Author

testing started for ASG servers.

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