Skip to content

rtcompat: Expose a SleepFuture::reset

Tokio and Smol both have a method on their version of SleepFuture to change the expiration time without having to create a new future:

These functions don't change any wakers associated with the future, so they can be used to adjust time time conveniently.

I'd like to use this in the padding implementation, and it would be convenient to have it elsewhere too.

But before we add a method like this, we need to do a little work:

  • If we're still supporting async_std, we need to emulate this behavior with a wrapper around async_std's timer code.
  • We need to emulate this in tor-rtmock.