Skip to content

Commit

Permalink
Fix last_bucket calc
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden committed Mar 29, 2024
1 parent 51b1035 commit 255911f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions neqo-common/src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,13 @@ impl<T> Timer<T> {
///
/// Impossible, I think.
pub fn take_next(&mut self, until: Instant) -> Option<T> {
let delta = self.delta(until);
let range = if self.cursor < delta {
let last_bucket = (self.cursor + self.delta(until)) % self.items.len();
let range = if self.cursor < last_bucket {
#[allow(clippy::range_plus_one)] // non-inclusive range to match with type below
(self.cursor..(self.cursor + delta + 1)).chain(0..0) // additional empty range to match
// with type below
(self.cursor..(last_bucket + 1)).chain(0..0) // additional empty range to match with
// type below
} else {
(self.cursor..self.items.len()).chain(0..delta)
(self.cursor..self.items.len()).chain(0..last_bucket)
};

for i in range {
Expand Down

0 comments on commit 255911f

Please sign in to comment.