mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-18 17:26:19 +00:00
Upper bound to PTO interval
Prevents overflow and improves worst-case latency on erratic links with high idle timeouts.
This commit is contained in:
committed by
Dirkjan Ochtman
parent
d80efde3e9
commit
adc41e4b2d
@@ -685,8 +685,10 @@ impl Connection {
|
||||
}
|
||||
|
||||
// Calculate PTO duration
|
||||
const MAX_PTO_EXPONENT: u32 = 24; // 2^24μs = ~17 seconds
|
||||
let timeout = self.rtt.smoothed + 4 * self.rtt.var + self.max_ack_delay();
|
||||
let timeout = cmp::max(timeout, TIMER_GRANULARITY) * 2u64.pow(self.pto_count);
|
||||
let timeout = cmp::max(timeout, TIMER_GRANULARITY)
|
||||
* 2u64.pow(cmp::min(self.pto_count, MAX_PTO_EXPONENT));
|
||||
self.io.timer_start(
|
||||
Timer::LossDetection,
|
||||
self.time_of_last_sent_ack_eliciting_packet + timeout,
|
||||
|
||||
Reference in New Issue
Block a user