forked from quic-go/quic-go
use default RTT (100ms) for 0-RTT if no prior estimate (#5388)
* utils: initialize the {Smoothed, Latest, Min}RTT to 100ms
* utils: use time.Duration.Nanoseconds instead of uint64
No functional change expected.
* congestion: better check to avoid division by zero
This commit is contained in:
@@ -278,8 +278,8 @@ func (c *cubicSender) isCwndLimited(bytesInFlight protocol.ByteCount) bool {
|
||||
func (c *cubicSender) BandwidthEstimate() Bandwidth {
|
||||
srtt := c.rttStats.SmoothedRTT()
|
||||
if srtt == 0 {
|
||||
// If we haven't measured an rtt, the bandwidth estimate is unknown.
|
||||
return infBandwidth
|
||||
// This should never happen, but if it does, avoid division by zero.
|
||||
srtt = protocol.TimerGranularity
|
||||
}
|
||||
return BandwidthFromDelta(c.GetCongestionWindow(), srtt)
|
||||
}
|
||||
|
||||
@@ -162,7 +162,6 @@ func TestCubicSenderExponentialSlowStart(t *testing.T) {
|
||||
// At startup make sure we can send.
|
||||
require.True(t, sender.sender.CanSend(0))
|
||||
require.Zero(t, sender.sender.TimeUntilSend(0))
|
||||
require.Equal(t, infBandwidth, sender.sender.BandwidthEstimate())
|
||||
|
||||
const numberOfAcks = 20
|
||||
for range numberOfAcks {
|
||||
|
||||
Reference in New Issue
Block a user