Commit 57608f96 authored by Nick Mathewson's avatar Nick Mathewson 🦞
Browse files

Add RetrySchedule::reset()

Previously the code would do stuff like

```
    schedule = RetrySchedule::new(INITIAL_DELAY);
```

which is needlessly verbose, since the schedule already keeps track
of its initial delay.
parent 75fd63a1
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -103,6 +103,11 @@ impl RetryDelay {
    pub fn next_delay<R: Rng>(&mut self, rng: &mut R) -> Duration {
    pub fn next_delay<R: Rng>(&mut self, rng: &mut R) -> Duration {
        Duration::from_millis(u64::from(self.next_delay_msec(rng)))
        Duration::from_millis(u64::from(self.next_delay_msec(rng)))
    }
    }

    /// Return this [`RetryDelay`] to its original state.
    pub fn reset(&mut self) {
        self.last_delay_ms = 0;
    }
}
}


impl Default for RetryDelay {
impl Default for RetryDelay {
+4 −1
Original line number Original line Diff line number Diff line
@@ -18,6 +18,10 @@ We can delete older sections here after we bump the releases.


## Since Arti 0.2.0
## Since Arti 0.2.0


### tor-basic-util

MODIFIED: Added `reset()` method to RetrySchedule.

### tor-socksproto
### tor-socksproto


BREAKING: Removed some unused accessors.
BREAKING: Removed some unused accessors.
@@ -25,4 +29,3 @@ BREAKING: Removed some unused accessors.
### tor-rtmock
### tor-rtmock


MODIFIED: Added add_blackhole to MockNetwork.
MODIFIED: Added add_blackhole to MockNetwork.