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

fix(protocol): Don't reserve memory on packet decoding error #360

Merged
merged 3 commits into from
Dec 1, 2024

Conversation

HookWoods
Copy link
Contributor

@HookWoods HookWoods commented Dec 1, 2024

Description

This MR fix #354 by returning in client poll function to avoid reserving 4096 bytes for each wrong packet

Testing

Using the small program provided in #354 and see that ram never went up

Checklist

Things need to be done before this Pull Request can be merged.

  • Code is well-formatted and adheres to project style guidelines: cargo fmt
  • Code does not produce any clippy warnings: cargo clippy
  • All unit tests pass: cargo test
  • I added new unit tests, so other people don't accidentally break my code by changing other parts of the codebase. How?

@Commandcracker
Copy link
Contributor

Works 👍
Now there is only rate limiting left (for another pr) so we don't burn the CPU :P

Normal
image
Spam
Screenshot 2024-12-01 020343

@Commandcracker
Copy link
Contributor

Wait, shouldn't it return false ?

@Snowiiii
Copy link
Owner

Snowiiii commented Dec 1, 2024

Looks good.
Thank you @HookWoods

@Snowiiii Snowiiii merged commit 1fd966f into Snowiiii:master Dec 1, 2024
9 checks passed
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.

Packet decoder memory leak
4 participants