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

getServersResponse can not handle fragmented responses #851

Open
Jeffx539 opened this issue Aug 18, 2024 · 1 comment
Open

getServersResponse can not handle fragmented responses #851

Jeffx539 opened this issue Aug 18, 2024 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Jeffx539
Copy link

Heya,

This isn't really an issue right now because h1-mod only has a handful of servers, however getServersResponse can not handle responses which are fragmented over several UDP packets. getServersResponse is fragmented into several chunks if it exceeds a predefined limit (usually the layer 2 MTU of around 1500),

network::on("getServersResponse", [](const game::netadr_s& target, const std::string& data)

The code currently only handles one UDP frame.

An example of something the code can't handle

Packet 1

getServersResponse\IP,PORT\
\IP,PORT\
\IP,PORT\
\IP,PORT\
.....

Packet 2

IP,PORT\
\IP,PORT\
\IP,PORT\
\IP,PORT\


Packet 3

IP,PORT\
\IP,PORT\
\IP,PORT\
\IP,PORT\
\EOT

The correct implementation would be to keep consuming the UDP frames until you reach an \EOT packet. This would obviously need some sort of state machine for the networking layer. I don't think anything like this exists in the current codebase.

This is more of a backburner issue, but one nonetheless

Thanks,
I'll have a crack at implementing this when i can :)

@mjkzy
Copy link
Collaborator

mjkzy commented Aug 18, 2024

i do know boiii uses some custom fragment handling code for network responses, maybe this would benefit you if you'd like to make a PR for this issue :D
https://github.com/Ezz-lol/boiii-free/blob/main/src/client/game/fragment_handler.cpp

@mjkzy mjkzy added bug Something isn't working good first issue Good for newcomers labels Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants