forked from quic-go/quic-go
Merge pull request #2457 from lucas-clemente/anti-deadlock-timer
correctly set anti-deadlock timer after the Initial space was dropped
This commit is contained in:
@@ -448,6 +448,12 @@ func (h *sentPacketHandler) setLossDetectionTimer() {
|
||||
|
||||
// PTO alarm
|
||||
sentTime, encLevel := h.getEarliestSentTimeAndSpace()
|
||||
if sentTime.IsZero() {
|
||||
if h.peerCompletedAddressValidation {
|
||||
panic("didn't expect sentTime to be zero")
|
||||
}
|
||||
sentTime = time.Now()
|
||||
}
|
||||
h.alarm = sentTime.Add(h.rttStats.PTO(encLevel == protocol.Encryption1RTT) << h.ptoCount)
|
||||
}
|
||||
|
||||
|
||||
@@ -793,6 +793,21 @@ var _ = Describe("SentPacketHandler", func() {
|
||||
handler.DropPackets(protocol.EncryptionHandshake)
|
||||
Expect(handler.GetLossDetectionTimeout()).To(BeZero())
|
||||
})
|
||||
|
||||
It("correctly sets the timer after the Initial packet number space has been dropped", func() {
|
||||
handler.SentPacket(initialPacket(&Packet{PacketNumber: 1, SendTime: time.Now().Add(-42 * time.Second)}))
|
||||
Expect(handler.ReceivedAck(
|
||||
&wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 1}}},
|
||||
protocol.EncryptionInitial,
|
||||
time.Now(),
|
||||
)).To(Succeed())
|
||||
handler.SentPacket(handshakePacketNonAckEliciting(&Packet{PacketNumber: 1, SendTime: time.Now()}))
|
||||
Expect(handler.initialPackets).To(BeNil())
|
||||
|
||||
pto := handler.rttStats.PTO(false)
|
||||
Expect(pto).ToNot(BeZero())
|
||||
Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", time.Now().Add(pto), 10*time.Millisecond))
|
||||
})
|
||||
})
|
||||
|
||||
Context("Packet-based loss detection", func() {
|
||||
|
||||
Reference in New Issue
Block a user