Remove ttfb_timeout and resp_timeout (#7925)

`TTFB_TIMEOUT` was deprecated in https://github.com/ethereum/consensus-specs/pull/3767.


  Remove `ttfb_timeout` from `InboundUpgrade` and other related structs.

(Update)
Also removed `resp_timeout` and also removed the `NetworkParams` struct since its fields are no longer used. https://github.com/sigp/lighthouse/pull/7925#issuecomment-3226886352
This commit is contained in:
Akihito Nakano
2025-09-03 11:00:15 +09:00
committed by GitHub
parent a9db8523a2
commit 7b5be8b1e7
6 changed files with 13 additions and 64 deletions

View File

@@ -39,6 +39,9 @@ const SHUTDOWN_TIMEOUT_SECS: u64 = 15;
/// Maximum number of simultaneous inbound substreams we keep for this peer.
const MAX_INBOUND_SUBSTREAMS: usize = 32;
/// Timeout that will be used for inbound and outbound responses.
const RESP_TIMEOUT: Duration = Duration::from_secs(10);
/// Identifier of inbound and outbound substreams from the handler's perspective.
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)]
pub struct SubstreamId(usize);
@@ -140,9 +143,6 @@ where
/// Waker, to be sure the handler gets polled when needed.
waker: Option<std::task::Waker>,
/// Timeout that will be used for inbound and outbound responses.
resp_timeout: Duration,
}
enum HandlerState {
@@ -224,7 +224,6 @@ where
pub fn new(
listen_protocol: SubstreamProtocol<RPCProtocol<E>, ()>,
fork_context: Arc<ForkContext>,
resp_timeout: Duration,
peer_id: PeerId,
connection_id: ConnectionId,
) -> Self {
@@ -246,7 +245,6 @@ where
outbound_io_error_retries: 0,
fork_context,
waker: None,
resp_timeout,
}
}
@@ -542,8 +540,7 @@ where
// If this substream has not ended, we reset the timer.
// Each chunk is allowed RESPONSE_TIMEOUT to be sent.
if let Some(ref delay_key) = info.delay_key {
self.inbound_substreams_delay
.reset(delay_key, self.resp_timeout);
self.inbound_substreams_delay.reset(delay_key, RESP_TIMEOUT);
}
// The stream may be currently idle. Attempt to process more
@@ -712,7 +709,7 @@ where
};
substream_entry.max_remaining_chunks = Some(max_remaining_chunks);
self.outbound_substreams_delay
.reset(delay_key, self.resp_timeout);
.reset(delay_key, RESP_TIMEOUT);
}
}
@@ -960,7 +957,7 @@ where
// Store the stream and tag the output.
let delay_key = self
.inbound_substreams_delay
.insert(self.current_inbound_substream_id, self.resp_timeout);
.insert(self.current_inbound_substream_id, RESP_TIMEOUT);
let awaiting_stream = InboundState::Idle(substream);
self.inbound_substreams.insert(
self.current_inbound_substream_id,
@@ -1036,7 +1033,7 @@ where
// new outbound request. Store the stream and tag the output.
let delay_key = self
.outbound_substreams_delay
.insert(self.current_outbound_substream_id, self.resp_timeout);
.insert(self.current_outbound_substream_id, RESP_TIMEOUT);
let awaiting_stream = OutboundSubstreamState::RequestPendingResponse {
substream: Box::new(substream),
request,