You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Servers using dataforest's DDoS protection always appear offline in the open.mp launcher, even though they display perfectly fine in the SA-MP launcher. This PR adjusts the payload so that it is not rejected.
Some affected servers:
143.20.37.52:7777
31.59.58.187:7777
185.213.240.246:7777
Before:
After:
Note: I don’t work with the stack that is used here, so the changes were made through Codex.
Description from clanker:
This fixes SA-MP server ping queries to follow the documented SA-MP query protocol.
Previously, the launcher sent the p ping query with four zero bytes as the payload. According to the SA-MP query mechanism, the ping packet should include four pseudo-random bytes after the p query type. Some servers, including ones behind DataForest DDoS protection, appear to reject or ignore the all-zero ping payload even though they still respond to other query types such as info, rules, and players.
The change replaces the hardcoded zero payload with a four-byte value generated from the current system time. The existing ping send/receive flow is otherwise unchanged, keeping the fix minimal while making the ping packet match the expected SA-MP format.
Nice one, but the maths in the nanosecond conversion is flawed.
Casting the duration.as_nanos() to a u32 means the maximum value it can hold before wrapping back to zero is 4,294,967,295. As these are nanoseconds, the timer will overflow every ~4 seconds. Therefore, if a packet takes longer than 4.3 seconds to roundtrip (like during a lag spike for example), the maths could wrap around and calculate an absurd ping.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Servers using dataforest's DDoS protection always appear offline in the open.mp launcher, even though they display perfectly fine in the SA-MP launcher. This PR adjusts the payload so that it is not rejected.
Some affected servers:
Before:

After:

Note: I don’t work with the stack that is used here, so the changes were made through Codex.
Description from clanker: