Skip to content
Snippets Groups Projects

Move RetryDelay into tor-basic-utils

Merged Nick Mathewson requested to merge nickm/arti:move-retry-delay into main
2 unresolved threads

This is a prerequisite for some work on #406 (closed) and #407 (closed).

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
101 101 pub fn next_delay<R: Rng>(&mut self, rng: &mut R) -> Duration {
102 102 Duration::from_millis(u64::from(self.next_delay_msec(rng)))
103 103 }
104
105 /// Return the most recent delay returned, if there was one.
106 pub fn last_delay(&self) -> Option<Duration> {
  • Comment on lines +105 to +106

    Could you make these #[cfg(test)] ? I'm a bit uncomfortable with making them part of the main API.

  • Not possible; after the move, these functions need to be accessed from tor-dirmgr's tests, and tests don't build other crates with cfg(test).

    How strongly do you feel that these functions shouldn't be part of the main API? I could put them behind a feature if you really think it's necessary.

  • Hmm. It seems like a detail I wouldn't want to expose; in particular, it's a part of the implementation of the precise algorith, and other kinds of stochastic retry algorithms might have different parameters.

    Perhaps this means that the tests are in the wrong place.

    Would it be too much trouble to put them behind an unstable-api feature gate? tor-basic-utils doesn't have one of those but it seems plausible that it should have one.

  • Okay; I'll add a commit to either do that, or to revise the tests (Depending on what's easier.)

  • Please register or sign in to reply
  • LGTM, one minor comment. Assuming you are happy with my suggestion, please go ahead and merge when you've made that change.

  • Nick Mathewson added 1 commit

    added 1 commit

    • 09f750c2 - RetryDelay: remove accessors.

    Compare with previous version

  • Thanks. that LGTM.

  • Ian Jackson mentioned in commit 644f962c

    mentioned in commit 644f962c

  • merged

  • Please register or sign in to reply
    Loading