diff --git a/internal/ackhandler/sent_packet_handler.go b/internal/ackhandler/sent_packet_handler.go index f6de118a..51e28fc0 100644 --- a/internal/ackhandler/sent_packet_handler.go +++ b/internal/ackhandler/sent_packet_handler.go @@ -246,6 +246,7 @@ func (h *sentPacketHandler) ReceivedAck(ackFrame *wire.AckFrame, withPacketNumbe h.ptoCount = 0 h.cryptoCount = 0 + h.numProbesToSend = 0 h.updateLossDetectionAlarm() return nil diff --git a/internal/ackhandler/sent_packet_handler_test.go b/internal/ackhandler/sent_packet_handler_test.go index 10d6d18e..cde872df 100644 --- a/internal/ackhandler/sent_packet_handler_test.go +++ b/internal/ackhandler/sent_packet_handler_test.go @@ -680,6 +680,16 @@ var _ = Describe("SentPacketHandler", func() { Expect(handler.retransmissionQueue).To(BeEmpty()) // 1 and 2 were already sent as probe packets }) + It("resets the send mode when it receives an acknowledgement after queueing probe packets", func() { + handler.SentPacket(retransmittablePacket(&Packet{PacketNumber: 1, SendTime: time.Now().Add(-time.Hour)})) + handler.rttStats.UpdateRTT(time.Second, 0, time.Now()) + handler.OnAlarm() + Expect(handler.SendMode()).To(Equal(SendPTO)) + ack := &wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 1}}} + Expect(handler.ReceivedAck(ack, 1, protocol.Encryption1RTT, time.Now())).To(Succeed()) + Expect(handler.SendMode()).To(Equal(SendAny)) + }) + It("gets packets sent before the probe packet for retransmission", func() { handler.SentPacket(retransmittablePacket(&Packet{PacketNumber: 1, SendTime: time.Now().Add(-time.Hour)})) handler.SentPacket(retransmittablePacket(&Packet{PacketNumber: 2, SendTime: time.Now().Add(-time.Hour)}))