Skip to content

Commit

Permalink
Tweak the upper method of SeqNumWindow. (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaofei0800 authored Jan 12, 2024
1 parent 766e89c commit ba0de61
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -60,9 +63,7 @@ impl SeqNumWindow {

/// Return the largest sequence number
fn upper(&self) -> u64 {
self.lower
.saturating_add(std::mem::size_of::<u128>() as u64 * 8)
- 1
self.lower.saturating_add(SEQ_NUM_WINDOW_SIZE) - 1
}
}

Expand Down

0 comments on commit ba0de61

Please sign in to comment.