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

Extend panic when pn_len is 0 with metadata #2134

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion neqo-transport/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2000,7 +2000,10 @@ impl Connection {
// Count how many bytes in this range are non-zero.
let pn_len = mem::size_of::<PacketNumber>()
- usize::try_from(unacked_range.leading_zeros() / 8).unwrap();
// pn_len can't be zero (unacked_range is > 0)
assert!(
pn_len > 0,
"pn_len can't be zero as unacked_range should be > 0, pn {pn}, largest_acknowledged {largest_acknowledged:?}, tx {tx}"
larseggert marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like codecov is failing, given that this particular line, i.e. the formatting in the case of a panic, is not covered by tests.

https://app.codecov.io/gh/mozilla/neqo/commit/f4af74c4a9fcbeb1b95092f180ea07bd7f110611

I don't think it makes sense to write tests for each of our assertions. If you think differently, I can add a test for this particular one.

);
larseggert marked this conversation as resolved.
Show resolved Hide resolved
// TODO(mt) also use `4*path CWND/path MTU` to set a minimum length.
builder.pn(pn, pn_len);
pn
Expand Down