Expand description
Per-peer adaptive timeout estimation using the TCP-inspired SRTT/RTTVAR algorithm.
This module dynamically adjusts per-peer operation timeouts based on observed RTT history, ensuring timeouts are neither too aggressive nor too conservative. The algorithm is modelled after RFC 6298 (TCP retransmission timer computation).
§Algorithm
On the first RTT sample for a peer:
SRTT = R
RTTVAR = R / 2On every subsequent sample:
RTTVAR = (1 - β) * RTTVAR + β * |SRTT - R|
SRTT = (1 - α) * SRTT + α * R
RTO = SRTT + 4 * RTTVARwhere α = 1/8 and β = 1/4 by default (RFC 6298 recommendations).
Structs§
- Adaptive
Timeout Config - Configuration for
PeerAdaptiveTimeout. - Peer
Adaptive Timeout - Per-peer adaptive timeout manager.
- RttSample
- A single RTT measurement for a specific peer.
- Timeout
Estimate - The current timeout estimate and smoothed RTT state for a single peer.
- Timeout
Stats - Aggregate statistics across all tracked peers.