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

Add an optional push limit to MessageBuilder. #348

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

ximon18
Copy link
Member

@ximon18 ximon18 commented Jul 9, 2024

This is useful when wanting to "reserve" space such that pushes to a message at one point in the code will leave enough room for subsequent pushes later, e.g. of OPT or TSIG RRs.

Note: I initially implemented this using Option<u16> but:

  • MessageBuilder doesn't itself impose a 65k limit on messages so u16 is not appropriate.
  • Testing >= against Option<usize> felt clumsy and slightly less efficient than just comparing to usize::MAX and usize::MAX seems a safe enough hack, but if not we can use Option if that is felt to be safer/better.

This is useful when wanting to "reserve" space such that pushes at one point in the code to the message will leave behind enough room for subsequent pushes later, e.g. of OPT or TSIG RRs.
@ximon18 ximon18 requested a review from a team July 9, 2024 12:39
@ximon18 ximon18 merged commit 0513eaa into main Jul 9, 2024
26 checks passed
@ximon18 ximon18 deleted the add-push-limit-to-message-builder branch July 9, 2024 13:36
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.

2 participants