diff options
Diffstat (limited to 'crates/tor-hsclient')
| -rw-r--r-- | crates/tor-hsclient/Cargo.toml | 1 | ||||
| -rw-r--r-- | crates/tor-hsclient/src/connect.rs | 4 | ||||
| -rw-r--r-- | crates/tor-hsclient/src/pow/v1.rs | 4 | ||||
| -rw-r--r-- | crates/tor-hsclient/src/state.rs | 2 |
4 files changed, 5 insertions, 6 deletions
diff --git a/crates/tor-hsclient/Cargo.toml b/crates/tor-hsclient/Cargo.toml index 354e48673..cb6542792 100644 --- a/crates/tor-hsclient/Cargo.toml +++ b/crates/tor-hsclient/Cargo.toml @@ -90,6 +90,7 @@ tor-proto = { version = "0.40.0", path = "../tor-proto", features = ["hs-client" tor-protover = { version = "0.40.0", path = "../tor-protover" } tor-rtcompat = { version = "0.40.0", path = "../tor-rtcompat" } tracing = "0.1.36" +web-time-compat = { version = "0.1.0", path = "../web-time-compat" } [dev-dependencies] humantime = "2" diff --git a/crates/tor-hsclient/src/connect.rs b/crates/tor-hsclient/src/connect.rs index 11b4f14e4..c547343d2 100644 --- a/crates/tor-hsclient/src/connect.rs +++ b/crates/tor-hsclient/src/connect.rs @@ -1,12 +1,9 @@ //! Main implementation of the connection functionality -use std::time::Duration; - use std::collections::HashMap; use std::fmt::Debug; use std::marker::PhantomData; use std::sync::Arc; -use std::time::Instant; use async_trait::async_trait; use educe::Educe; @@ -27,6 +24,7 @@ use tor_hscrypto::Subcredential; use tor_proto::TargetHop; use tor_proto::client::circuit::handshake::hs_ntor; use tracing::{debug, instrument, trace}; +use web_time_compat::{Duration, Instant}; use retry_error::RetryError; use safelog::{DispRedacted, Sensitive}; diff --git a/crates/tor-hsclient/src/pow/v1.rs b/crates/tor-hsclient/src/pow/v1.rs index 9993442cc..1b8a6b5ba 100644 --- a/crates/tor-hsclient/src/pow/v1.rs +++ b/crates/tor-hsclient/src/pow/v1.rs @@ -1,7 +1,6 @@ //! Client support for the `v1` onion service proof of work scheme use crate::err::ProofOfWorkError; -use std::time::Instant; use tor_async_utils::oneshot; use tor_async_utils::oneshot::Canceled; use tor_cell::relaycell::hs::pow::v1::ProofOfWorkV1; @@ -10,6 +9,7 @@ use tor_hscrypto::pk::HsBlindId; use tor_hscrypto::pow::v1::{Effort, Instance, SolverInput}; use tor_netdoc::doc::hsdesc::pow::v1::PowParamsV1; use tracing::debug; +use web_time_compat::{Instant, InstantExt}; /// Double effort at retry until this threshold. /// @@ -93,7 +93,7 @@ impl HsPowClientV1 { // TODO: config option input.runtime(Default::default()); - let start_time = Instant::now(); + let start_time = Instant::get(); debug!("beginning solve, {:?}", self.effort); let (result_sender, result_receiver) = oneshot::channel(); diff --git a/crates/tor-hsclient/src/state.rs b/crates/tor-hsclient/src/state.rs index b3fc983d2..239613287 100644 --- a/crates/tor-hsclient/src/state.rs +++ b/crates/tor-hsclient/src/state.rs @@ -5,7 +5,6 @@ use std::fmt::Debug; use std::mem; use std::panic::AssertUnwindSafe; use std::sync::{Arc, Mutex, MutexGuard}; -use std::time::{Duration, Instant}; use futures::FutureExt as _; use futures::task::SpawnError; @@ -23,6 +22,7 @@ use tor_error::{Bug, ErrorReport as _, debug_report, error_report, internal}; use tor_hscrypto::pk::HsId; use tor_netdir::NetDir; use tor_rtcompat::{Runtime, SpawnExt as _}; +use web_time_compat::{Duration, Instant}; use crate::isol_map; use crate::{ConnError, HsClientConnector, HsClientSecretKeys}; |
