diff options
Diffstat (limited to 'crates/tor-proto/src/client')
6 files changed, 10 insertions, 7 deletions
diff --git a/crates/tor-proto/src/client/channel/handshake.rs b/crates/tor-proto/src/client/channel/handshake.rs index 48a594c45..a0130458e 100644 --- a/crates/tor-proto/src/client/channel/handshake.rs +++ b/crates/tor-proto/src/client/channel/handshake.rs @@ -93,7 +93,7 @@ impl< /// the relay's handshake information. /// /// Takes a function that reports the current time. In theory, this can just be - /// `SystemTime::now()`. + /// `SystemTime::get()`. #[instrument(skip_all, level = "trace")] pub async fn connect<F>(mut self, now_fn: F) -> Result<UnverifiedClientChannel<T, S>> where diff --git a/crates/tor-proto/src/client/circuit.rs b/crates/tor-proto/src/client/circuit.rs index bbd333b17..8ae369d2f 100644 --- a/crates/tor-proto/src/client/circuit.rs +++ b/crates/tor-proto/src/client/circuit.rs @@ -69,6 +69,7 @@ use tor_error::{bad_api_usage, internal, into_internal}; use tor_linkspec::{CircTarget, LinkSpecType, OwnedChanTarget, RelayIdType}; use tor_protover::named; use tor_rtcompat::DynTimeProvider; +use web_time_compat::Instant; use crate::circuit::UniqId; @@ -488,8 +489,8 @@ impl ClientCirc { /// /// NOTE that the Instant returned by this method is not affected by /// any runtime mocking; it is the output of an ordinary call to - /// `Instant::now()`. - pub async fn disused_since(&self) -> Result<Option<std::time::Instant>> { + /// `Instant::get()`. + pub async fn disused_since(&self) -> Result<Option<Instant>> { let (tx, rx) = oneshot::channel(); self.command .unbounded_send(CtrlCmd::GetTunnelActivity { sender: tx }) diff --git a/crates/tor-proto/src/client/circuit/padding/maybenot_padding.rs b/crates/tor-proto/src/client/circuit/padding/maybenot_padding.rs index 449ae8caf..c24a79154 100644 --- a/crates/tor-proto/src/client/circuit/padding/maybenot_padding.rs +++ b/crates/tor-proto/src/client/circuit/padding/maybenot_padding.rs @@ -31,7 +31,7 @@ use backend::PaddingBackend; /// The type of Instant that we'll use for our padding machines. /// /// We use a separate type alias here in case we want to move to coarsetime. -type Instant = std::time::Instant; +type Instant = web_time_compat::Instant; /// The type of Duration that we'll use for our padding machines. /// diff --git a/crates/tor-proto/src/client/circuit/padding/maybenot_padding/backend.rs b/crates/tor-proto/src/client/circuit/padding/maybenot_padding/backend.rs index 903db79ad..66b52793a 100644 --- a/crates/tor-proto/src/client/circuit/padding/maybenot_padding/backend.rs +++ b/crates/tor-proto/src/client/circuit/padding/maybenot_padding/backend.rs @@ -24,6 +24,7 @@ use std::{sync::Arc, task::Waker}; use maybenot::{MachineId, TriggerEvent}; use smallvec::SmallVec; +use web_time_compat::InstantExt; use super::{Bypass, Duration, Instant, PerHopPaddingEvent, PerHopPaddingEventVec, Replace}; @@ -341,7 +342,8 @@ impl<const N: usize> MaybenotPadder<N> { rules.machines.clone(), rules.max_outbound_padding_frac, rules.max_outbound_blocking_frac, - Instant::now(), + // TODO #2428 PADDING: We should be taking this from a SleepProvider! + Instant::get(), ThisThreadRng, )?; Ok(Self::from_framework(framework)) diff --git a/crates/tor-proto/src/client/reactor/circuit.rs b/crates/tor-proto/src/client/reactor/circuit.rs index 9bd4a7083..331e8ca02 100644 --- a/crates/tor-proto/src/client/reactor/circuit.rs +++ b/crates/tor-proto/src/client/reactor/circuit.rs @@ -52,6 +52,7 @@ use tor_error::{Bug, internal}; use tor_linkspec::RelayIds; use tor_llcrypto::pk; use tor_memquota::mq_queue::{ChannelSpec as _, MpscSpec}; +use web_time_compat::{Duration, Instant, SystemTime}; use futures::SinkExt as _; use oneshot_fused_workaround as oneshot; @@ -69,7 +70,6 @@ use std::borrow::Borrow; use std::pin::Pin; use std::result::Result as StdResult; use std::sync::Arc; -use std::time::{Duration, Instant, SystemTime}; use extender::HandshakeAuxDataHandler; diff --git a/crates/tor-proto/src/client/reactor/circuit/circhop.rs b/crates/tor-proto/src/client/reactor/circuit/circhop.rs index fc6b90404..d2b72a38d 100644 --- a/crates/tor-proto/src/client/reactor/circuit/circhop.rs +++ b/crates/tor-proto/src/client/reactor/circuit/circhop.rs @@ -27,6 +27,7 @@ use tor_cell::relaycell::{ AnyRelayMsgOuter, RelayCellDecoder, RelayCellDecoderResult, RelayCellFormat, StreamId, UnparsedRelayMsg, }; +use web_time_compat::Instant; use safelog::sensitive as sv; use tor_error::Bug; @@ -35,7 +36,6 @@ use tracing::instrument; use std::result::Result as StdResult; use std::sync::{Arc, Mutex, MutexGuard}; use std::task::Poll; -use std::time::Instant; #[cfg(test)] use tor_cell::relaycell::msg::SendmeTag; |
