forked from quic-go/quic-go
move calculation of the PTO to the rttStats
The PTO value is needed at various places in the protocol. Calculating it on the rttStats struct will allow us to pass around this struct.
This commit is contained in:
@@ -342,7 +342,7 @@ func (h *sentPacketHandler) updateLossDetectionAlarm() {
|
||||
// Early retransmit timer or time loss detection.
|
||||
h.alarm = h.lossTime
|
||||
} else { // PTO alarm
|
||||
h.alarm = h.lastSentAckElicitingPacketTime.Add(h.computePTOTimeout() << h.ptoCount)
|
||||
h.alarm = h.lastSentAckElicitingPacketTime.Add(h.rttStats.PTO() << h.ptoCount)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -657,10 +657,6 @@ func (h *sentPacketHandler) computeCryptoTimeout() time.Duration {
|
||||
return duration << h.cryptoCount
|
||||
}
|
||||
|
||||
func (h *sentPacketHandler) computePTOTimeout() time.Duration {
|
||||
return h.rttStats.SmoothedOrInitialRTT() + utils.MaxDuration(4*h.rttStats.MeanDeviation(), protocol.TimerGranularity) + h.rttStats.MaxAckDelay()
|
||||
}
|
||||
|
||||
func (h *sentPacketHandler) ResetForRetry() error {
|
||||
h.cryptoCount = 0
|
||||
h.bytesInFlight = 0
|
||||
|
||||
Reference in New Issue
Block a user