tor-rtcompat: make CompoundRuntime handle SleepProviders properly

Previously, CompoundRuntime would use the default implementations of
SleepProvider::now() and ::wallclock(), instead of using its wrapped
SleepProvider. This mildly embarrassing omission has been rectified.
This commit is contained in:
eta 2022-05-04 16:43:39 +01:00
parent a9bae9adfe
commit f0739e46aa
1 changed files with 11 additions and 0 deletions

View File

@ -8,6 +8,7 @@ use async_trait::async_trait;
use educe::Educe;
use futures::{future::FutureObj, task::Spawn};
use std::io::Result as IoResult;
use std::time::{Instant, SystemTime};
/// A runtime made of several parts, each of which implements one trait-group.
///
@ -89,6 +90,16 @@ where
fn sleep(&self, duration: Duration) -> Self::SleepFuture {
self.inner.sleep.sleep(duration)
}
#[inline]
fn now(&self) -> Instant {
self.inner.sleep.now()
}
#[inline]
fn wallclock(&self) -> SystemTime {
self.inner.sleep.wallclock()
}
}
#[async_trait]