Skip to content

Commit

Permalink
fix deadline increase behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowhatter committed Nov 22, 2024
1 parent 1ca7057 commit d906813
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions io/zenoh-transport/src/common/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ impl WaitTime {
Self { wait_time, ttl }
}

fn advance(&mut self) {
fn advance(&mut self, instant: &mut Instant) {
if let Some(new_ttl) = self.ttl.checked_sub(1) {
*instant += self.wait_time;
self.ttl = new_ttl;
self.wait_time *= 2;
}
Expand Down Expand Up @@ -178,9 +179,7 @@ impl LazyDeadline {
// SAFETY: this is safe because DeadlineSetting::Finite is returned by
// deadline() only if wait_time is Some(_)
let wait_time = unsafe { self.wait_time.as_mut().unwrap_unchecked() };

instant = instant.add(wait_time.wait_time());
wait_time.advance();
wait_time.advance(&mut instant);

self.deadline = Some(DeadlineSetting::Finite(instant));
}
Expand Down

0 comments on commit d906813

Please sign in to comment.