diff --git a/internal/ackhandler/sent_packet_handler.go b/internal/ackhandler/sent_packet_handler.go index c6325a3ed..d731acd9e 100644 --- a/internal/ackhandler/sent_packet_handler.go +++ b/internal/ackhandler/sent_packet_handler.go @@ -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 } diff --git a/internal/ackhandler/sent_packet_handler_test.go b/internal/ackhandler/sent_packet_handler_test.go index ab2d64e08..3b700db0f 100644 --- a/internal/ackhandler/sent_packet_handler_test.go +++ b/internal/ackhandler/sent_packet_handler_test.go @@ -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() {