-
Notifications
You must be signed in to change notification settings - Fork 147
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
Sendqueue pkt header size #379
Conversation
… rustc-serialize, which has had a history of causing builds to print deprecation warnings.
… pull in rustc-serialize, which has had a history of causing builds to print deprecation warnings." This reverts commit 36138ca.
that want to precalculate required total SendQueue size. This size is available using other types in the crate, but tying the query to the `SendQueue` allows us to avoid a breaking change in case the SendQueue's header ever changes (even though this is highly unlikely to happen).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qrnch-jan the code does not look windows-exclusive. Would you be able to add this function to some reasonable place that is accessible on all platforms and add a small unit test to ensure code coverage?
@Wojtek242 It is indeed not strictly Windows-exclusive, but the reason I put it there was to emphasize that it's the size of the packet header used by {win,n}pcap send queues, and it's the size one should use to calculate required sendqueue sizes. I have moved the function, and documented that it's the one that should be used by |
There's currently a gap for applications that want to precalculate the exact
SendQueue
size required for a batch of packets -- the application doesn't know[*] the exact size of the packet header that is implicitly added with each packet. This PR adds a constant function, tied toSendQueue
, that will allow applications to easily get the size without bothering with any other details.[*] Well, this isn't technically true -- it happens to be the same size and layout as packet headers found elsewhere in the crate. However, the benefit of this implementation is that it considers the exact type an implementation detail that the application doesn't need to care about.