Merge pull request #2402 from lucas-clemente/reset-pto-count-when-dropping-pn-space

reset the PTO count when dropping a packet number space
This commit is contained in:
Marten Seemann
2020-03-10 16:49:56 +07:00
committed by GitHub
2 changed files with 3 additions and 1 deletions

View File

@@ -159,6 +159,7 @@ func (h *sentPacketHandler) dropPackets(encLevel protocol.EncryptionLevel) {
panic(fmt.Sprintf("Cannot drop keys for encryption level %s", encLevel))
}
h.setLossDetectionTimer()
h.ptoCount = 0
h.ptoMode = SendNone
}

View File

@@ -601,7 +601,7 @@ var _ = Describe("SentPacketHandler", func() {
Expect(handler.GetLossDetectionTimeout().Sub(sendTime)).To(Equal(4 * timeout))
})
It("resets the PTO mode when a packet number space is dropped", func() {
It("resets the PTO mode and PTO count when a packet number space is dropped", func() {
now := time.Now()
handler.SentPacket(ackElicitingPacket(&Packet{
PacketNumber: 1,
@@ -621,6 +621,7 @@ var _ = Describe("SentPacketHandler", func() {
// PTO timer based on the 1-RTT packet
Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", now.Add(-time.Hour), time.Second))
Expect(handler.SendMode()).ToNot(Equal(SendPTOHandshake))
Expect(handler.ptoCount).To(BeZero())
})
It("allows two 1-RTT PTOs", func() {