include the timer granularity in the advertised max_ack_delay

This commit is contained in:
Marten Seemann
2019-05-08 13:26:08 +09:00
parent af8c03ebaf
commit 6c27967c8a
5 changed files with 14 additions and 8 deletions

View File

@@ -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
}