forked from quic-go/quic-go
include the timer granularity in the advertised max_ack_delay
This commit is contained in:
@@ -17,8 +17,6 @@ const (
|
||||
// Maximum reordering in time space before time based loss detection considers a packet lost.
|
||||
// Specified as an RTT multiplier.
|
||||
timeThreshold = 9.0 / 8
|
||||
// Timer granularity. The timer will not be set to a value smaller than granularity.
|
||||
granularity = time.Millisecond
|
||||
)
|
||||
|
||||
type packetNumberSpace struct {
|
||||
@@ -341,7 +339,7 @@ func (h *sentPacketHandler) detectLostPackets(
|
||||
lossDelay := time.Duration(timeThreshold * maxRTT)
|
||||
|
||||
// Minimum time of granularity before packets are deemed lost.
|
||||
lossDelay = utils.MaxDuration(lossDelay, granularity)
|
||||
lossDelay = utils.MaxDuration(lossDelay, protocol.TimerGranularity)
|
||||
|
||||
var lostPackets []*Packet
|
||||
pnSpace.history.Iterate(func(packet *Packet) (bool, error) {
|
||||
@@ -616,7 +614,7 @@ func (h *sentPacketHandler) queuePacketForRetransmission(p *Packet, pnSpace *pac
|
||||
}
|
||||
|
||||
func (h *sentPacketHandler) computeCryptoTimeout() time.Duration {
|
||||
duration := utils.MaxDuration(2*h.rttStats.SmoothedOrInitialRTT(), granularity)
|
||||
duration := utils.MaxDuration(2*h.rttStats.SmoothedOrInitialRTT(), protocol.TimerGranularity)
|
||||
// exponential backoff
|
||||
// There's an implicit limit to this set by the crypto timeout.
|
||||
return duration << h.cryptoCount
|
||||
@@ -624,7 +622,7 @@ func (h *sentPacketHandler) computeCryptoTimeout() time.Duration {
|
||||
|
||||
func (h *sentPacketHandler) computePTOTimeout() time.Duration {
|
||||
// TODO(#1236): include the max_ack_delay
|
||||
duration := utils.MaxDuration(h.rttStats.SmoothedOrInitialRTT()+4*h.rttStats.MeanDeviation(), granularity)
|
||||
duration := utils.MaxDuration(h.rttStats.SmoothedOrInitialRTT()+4*h.rttStats.MeanDeviation(), protocol.TimerGranularity)
|
||||
return duration << h.ptoCount
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user