only set the loss detection alarm if packets are outstanding

This commit is contained in:
Marten Seemann
2018-06-18 10:42:45 +07:00
parent a737aca658
commit 4633acd7bf
4 changed files with 156 additions and 15 deletions

View File

@@ -301,12 +301,12 @@ func (h *sentPacketHandler) maybeUpdateRTT(largestAcked protocol.PacketNumber, a
func (h *sentPacketHandler) updateLossDetectionAlarm() {
// Cancel the alarm if no packets are outstanding
if h.packetHistory.Len() == 0 {
if !h.packetHistory.HasOutstandingPackets() {
h.alarm = time.Time{}
return
}
if !h.handshakeComplete {
if h.packetHistory.HasOutstandingHandshakePackets() {
h.alarm = h.lastSentHandshakePacketTime.Add(h.computeHandshakeTimeout())
} else if !h.lossTime.IsZero() {
// Early retransmit timer or time loss detection.