From c4613cf4275a71c956e8fe9a7033c0136023c1c0 Mon Sep 17 00:00:00 2001 From: xiaofei0800 Date: Fri, 12 Jan 2024 11:24:56 +0800 Subject: [PATCH] Tweak the upper method of SeqNumWindow. --- src/window.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/window.rs b/src/window.rs index 308d734d..52966f64 100644 --- a/src/window.rs +++ b/src/window.rs @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +/// Maximum count of sequence number in the sliding window. +const SEQ_NUM_WINDOW_SIZE: u64 = 128; + /// A sliding window packet number for deduplication detection. /// See RFC 4303 Section 3.4.3 for a similar algorithm. #[derive(Clone, Copy, Default)] @@ -60,9 +63,7 @@ impl SeqNumWindow { /// Return the largest sequence number fn upper(&self) -> u64 { - self.lower - .saturating_add(std::mem::size_of::() as u64 * 8) - - 1 + self.lower.saturating_add(SEQ_NUM_WINDOW_SIZE) - 1 } }