summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/congestion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/tor-proto/src/congestion')
-rw-r--r--crates/tor-proto/src/congestion/rtt.rs6
-rw-r--r--crates/tor-proto/src/congestion/vegas.rs8
2 files changed, 6 insertions, 8 deletions
diff --git a/crates/tor-proto/src/congestion/rtt.rs b/crates/tor-proto/src/congestion/rtt.rs
index 14b939f5b..ac04112f3 100644
--- a/crates/tor-proto/src/congestion/rtt.rs
+++ b/crates/tor-proto/src/congestion/rtt.rs
@@ -3,7 +3,7 @@
use std::cmp::{max, min};
use std::collections::VecDeque;
use std::sync::atomic::{AtomicBool, Ordering};
-use std::time::{Duration, Instant};
+use web_time_compat::{Duration, Instant};
use super::params::RoundTripEstimatorParams;
use super::{CongestionWindow, State};
@@ -269,7 +269,7 @@ mod test {
#![allow(clippy::needless_pass_by_value)]
//! <!-- @@ end test lint list maintained by maint/add_warning @@ -->
- use std::time::{Duration, Instant};
+ use web_time_compat::{Duration, Instant, InstantExt};
use crate::congestion::test_utils::{new_cwnd, new_rtt_estimator};
@@ -333,7 +333,7 @@ mod test {
#[test]
fn test_vectors() {
let mut rtt = new_rtt_estimator();
- let now = Instant::now();
+ let now = Instant::get();
// from C-tor src/test/test_congestion_control.c
let vectors = [
[100000, 200000, 124, 1, 100000, 100000, 100000],
diff --git a/crates/tor-proto/src/congestion/vegas.rs b/crates/tor-proto/src/congestion/vegas.rs
index 0ad46deef..e0f2af68a 100644
--- a/crates/tor-proto/src/congestion/vegas.rs
+++ b/crates/tor-proto/src/congestion/vegas.rs
@@ -343,11 +343,9 @@ pub(crate) mod test {
#![allow(clippy::needless_pass_by_value)]
//! <!-- @@ end test lint list maintained by maint/add_warning @@ -->
- use std::{
- collections::VecDeque,
- time::{Duration, Instant},
- };
+ use std::collections::VecDeque;
use tor_units::Percentage;
+ use web_time_compat::{Duration, Instant, InstantExt};
use super::*;
use crate::congestion::{
@@ -433,7 +431,7 @@ pub(crate) mod test {
self.vegas.set_inflight(p.inflight_in);
self.vegas.set_is_blocked_on_chan(p.or_conn_blocked_in);
- let now = Instant::now();
+ let now = Instant::get();
self.rtt
.expect_sendme(now + Duration::from_micros(p.sent_usec_in));
let ret = self.rtt.update(