Set minimum value for RTT in TCP.

RTT value should not be zero, set the minimum RTT value to 1ms. This does not
happen often and was identified while investigating
http://gvisor.dev/issues/6113.

Updates #6113

PiperOrigin-RevId: 536885961
This commit is contained in:
Nayana Bidari
2023-05-31 19:14:49 -07:00
committed by gVisor bot
parent d1148811c6
commit c77d00a7ee
+7
View File
@@ -34,6 +34,9 @@ const (
// MaxRTO is the maximum allowed value for the retransmit timeout.
MaxRTO = 120 * time.Second
// MinSRTT is the minimum allowed value for smoothed RTT.
MinSRTT = 1 * time.Millisecond
// InitialCwnd is the initial congestion window.
InitialCwnd = 10
@@ -384,6 +387,10 @@ func (s *sender) updateRTO(rtt time.Duration) {
}
}
if s.rtt.TCPRTTState.SRTT < MinSRTT {
s.rtt.TCPRTTState.SRTT = MinSRTT
}
s.RTO = s.rtt.TCPRTTState.SRTT + 4*s.rtt.TCPRTTState.RTTVar
s.rtt.Unlock()
if s.RTO < s.minRTO {