diff --git a/ackhandler/sent_packet_handler.go b/ackhandler/sent_packet_handler.go index c527995fe..598d4e897 100644 --- a/ackhandler/sent_packet_handler.go +++ b/ackhandler/sent_packet_handler.go @@ -308,6 +308,7 @@ func (h *sentPacketHandler) OnAlarm() { // TODO(#497): TLP if !h.handshakeComplete { h.queueHandshakePacketsForRetransmission() + h.handshakeCount++ } else if !h.lossTime.IsZero() { // Early retransmit or time loss detection h.detectLostPackets() diff --git a/ackhandler/sent_packet_handler_test.go b/ackhandler/sent_packet_handler_test.go index 7cc87ac64..dbadd0b12 100644 --- a/ackhandler/sent_packet_handler_test.go +++ b/ackhandler/sent_packet_handler_test.go @@ -846,7 +846,8 @@ var _ = Describe("SentPacketHandler", func() { err = handler.ReceivedAck(&wire.AckFrame{LargestAcked: 1, LowestAcked: 1}, 1, time.Now().Add(time.Hour)) Expect(err).NotTo(HaveOccurred()) Expect(handler.lossTime.IsZero()).To(BeTrue()) - Expect(handler.GetAlarmTimeout().Sub(time.Now())).To(BeNumerically("~", handler.computeHandshakeTimeout(), time.Minute)) + handshakeTimeout := handler.computeHandshakeTimeout() + Expect(handler.GetAlarmTimeout().Sub(time.Now())).To(BeNumerically("~", handshakeTimeout, time.Minute)) handler.OnAlarm() p := handler.DequeuePacketForRetransmission() @@ -857,6 +858,9 @@ var _ = Describe("SentPacketHandler", func() { Expect(p.PacketNumber).To(Equal(protocol.PacketNumber(4))) Expect(handler.packetHistory.Len()).To(Equal(1)) Expect(handler.packetHistory.Front().Value.PacketNumber).To(Equal(protocol.PacketNumber(3))) + Expect(handler.handshakeCount).To(BeEquivalentTo(1)) + // make sure the exponential backoff is used + Expect(handler.computeHandshakeTimeout()).To(BeNumerically("~", 2*handshakeTimeout, time.Minute)) }) })