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: apply max payload option when encoding (fix #113) #114

Merged
merged 6 commits into from
Oct 18, 2023

Conversation

Totodore
Copy link
Owner

@Totodore Totodore commented Oct 18, 2023

This PR apply the max_payload_size option to the encoding process for polling. Before, it was only applied when decoding.
In order to calculate the size of the payload with the next packet without polling it from the channel, a PeekableReceiver struct was made to peek the next element without polling it.

For the v3 protocol the current payload computed size is not accurate because the size in chars of the packet is included in the payload. And getting that information before adding the packet is not possible (also it is a O(n) operation). Therefore the max packet size length is apply, it is the number of digit of the maximum payload size.

@Totodore Totodore added the C-Bug Something isn't working label Oct 18, 2023
@Totodore Totodore linked an issue Oct 18, 2023 that may be closed by this pull request
@Totodore Totodore merged commit bff021a into main Oct 18, 2023
@Totodore Totodore deleted the ft-max-payload-encoding branch October 18, 2023 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apply the max payload option when encoding packets
1 participant