feat(s2n-quic-dc): Replace shared map with larger bitset #2464
+179
−442
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Release Summary:
n/a
Resolved issues:
n/a
Description of changes:
This simplifies the receiver dedup implementation by replacing it with an inline bitset, which we shift over on new arrivals. The end result is that we have an effective tracker for ~896 packets fitting into about the same amount of space as the previous combination of shared map and entry data (+6 bytes/entry if we assume 500k entries).
The new implementation is also easier to tweak, since we directly expose the window size. It's likely that this slows down inserts a little (we need to shift over 112 bytes at the current size) but shuffling a 112-byte array should be sufficiently fast that I don't think it's worth worrying about it.
Call-outs:
I'd be open to re-writing bitvec's parts into our code if we wanted to, but it's a bit tricky to get the shifting right (doable but ugly). It seems like a pretty reasonable tradeoff for the current moment to take that dependency and we can revisit down the line.
My expectation is that as-is this should generally improve the likelihood we accurately track replay for incoming packets. We previously had some chance that we could track packets across effectively infinite range (since we'd store the full Credentials in the backup map), so it's not a perfect tradeoff, but I tend to expect this to improve things overall.
Testing:
Tests are slightly updated, but mostly keeping the pre-existing coverage.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.