only send one ACK for every 10 retransmittable packets

This commit is contained in:
Marten Seemann 2018-01-28 17:59:37 +07:00
parent 96a31a51e5
commit fc5f54824a
2 changed files with 10 additions and 6 deletions

View file

@ -95,13 +95,17 @@ var _ = Describe("receivedPacketHandler", func() {
Expect(handler.GetAlarmTimeout()).To(BeZero())
})
It("queues an ACK for every second retransmittable packet, if they are arriving fast", func() {
It("queues an ACK for every RetransmittablePacketsBeforeAck retransmittable packet, if they are arriving fast", func() {
receiveAndAck10Packets()
err := handler.ReceivedPacket(11, time.Time{}, true)
Expect(err).ToNot(HaveOccurred())
Expect(handler.ackQueued).To(BeFalse())
p := protocol.PacketNumber(11)
for i := 0; i < protocol.RetransmittablePacketsBeforeAck-1; i++ {
err := handler.ReceivedPacket(p, time.Time{}, true)
Expect(err).ToNot(HaveOccurred())
Expect(handler.ackQueued).To(BeFalse())
p++
}
Expect(handler.GetAlarmTimeout()).NotTo(BeZero())
err = handler.ReceivedPacket(12, time.Time{}, true)
err := handler.ReceivedPacket(p, time.Time{}, true)
Expect(err).ToNot(HaveOccurred())
Expect(handler.ackQueued).To(BeTrue())
Expect(handler.GetAlarmTimeout()).To(BeZero())