move calculation of RTO delay to the sent packet handler

This commit is contained in:
Marten Seemann
2018-04-16 11:18:14 +09:00
parent ef286afa3c
commit 2b9b949855
6 changed files with 8 additions and 52 deletions

View File

@@ -545,9 +545,12 @@ func (h *sentPacketHandler) computeHandshakeTimeout() time.Duration {
}
func (h *sentPacketHandler) computeRTOTimeout() time.Duration {
rto := h.congestion.RetransmissionDelay()
if rto == 0 {
var rto time.Duration
rtt := h.rttStats.SmoothedRTT()
if rtt == 0 {
rto = defaultRTOTimeout
} else {
rto = rtt + 4*h.rttStats.MeanDeviation()
}
rto = utils.MaxDuration(rto, minRTOTimeout)
// Exponential backoff