From ee8ce39bf3901786d3767cf2d690ba1d73a369ae Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 1 Nov 2026 21:01:43 +0100 Subject: introduce per-transport sync reply timeout --- src/transport/tor.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/transport/tor.rs') 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 { vec![self.shared.local_id.clone()] } -- cgit v1.3.1