aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/tor.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-01 21:01:43 +0100
committertv <tv@krebsco.de>2026-11-01 21:01:43 +0100
commitee8ce39bf3901786d3767cf2d690ba1d73a369ae (patch)
tree237519074f84dacd54a979cbd780dfcf127d178b /src/transport/tor.rs
parent13b1061ee221a03168ba99f311e56d0896ef319b (diff)
introduce per-transport sync reply timeout
Diffstat (limited to 'src/transport/tor.rs')
-rw-r--r--src/transport/tor.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/transport/tor.rs b/src/transport/tor.rs
index 26dab14..7ecd624 100644
--- a/src/transport/tor.rs
+++ b/src/transport/tor.rs
@@ -76,6 +76,8 @@ const CONNECT_TIMEOUT: Duration = Duration::from_secs(60);
const HANDSHAKE_TIMEOUT: Duration = Duration::from_secs(30);
/// How long a message may take, before what its size adds (`stream_timeout`).
const STREAM_TIMEOUT: Duration = Duration::from_secs(30);
+/// The first wait for an answer to a sync message (`Transport::sync_reply_timeout`).
+const SYNC_REPLY_TIMEOUT: Duration = Duration::from_secs(30);
/// The slowest a message is expected to go over Tor, in bytes per second.
const MIN_RATE: u64 = 64 << 10;
/// Messages read and not handled yet, at most.
@@ -569,6 +571,12 @@ impl Transport for TorTransport {
stream_timeout(MAX_MESSAGE)
}
+ /// Round trips over Tor take a second or more, and the first message to a peer
+ /// waits for a connection (`CONNECT_TIMEOUT`, `HANDSHAKE_TIMEOUT`).
+ fn sync_reply_timeout(&self) -> Duration {
+ SYNC_REPLY_TIMEOUT
+ }
+
fn local_addresses(&self) -> Vec<String> {
vec![self.shared.local_id.clone()]
}