Merge pull request #1333 from lucas-clemente/acks-for-delayed-packets

don't send an ACK when receiving a packet that wouldn't be acked
This commit is contained in:
Marten Seemann 2018-05-05 14:54:11 +09:00 committed by GitHub
commit 45d5acef14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View file

@ -159,7 +159,7 @@ var _ = Describe("receivedPacketHandler", func() {
Expect(err).ToNot(HaveOccurred())
err = handler.ReceivedPacket(13, time.Time{}, true)
Expect(err).ToNot(HaveOccurred())
ack := handler.GetAckFrame() // ACK: 1 and 3, missing: 2
ack := handler.GetAckFrame() // ACK: 1-11 and 13, missing: 12
Expect(ack).ToNot(BeNil())
Expect(ack.HasMissingRanges()).To(BeTrue())
Expect(handler.ackQueued).To(BeFalse())
@ -168,6 +168,23 @@ var _ = Describe("receivedPacketHandler", func() {
Expect(handler.ackQueued).To(BeTrue())
})
It("doesn't queue an ACK if it was reported missing before, but is below the threshold", func() {
receiveAndAck10Packets()
// 11 is missing
err := handler.ReceivedPacket(12, time.Time{}, true)
Expect(err).ToNot(HaveOccurred())
err = handler.ReceivedPacket(13, time.Time{}, true)
Expect(err).ToNot(HaveOccurred())
ack := handler.GetAckFrame() // ACK: 1-10, 12-13
Expect(ack).ToNot(BeNil())
// now receive 11
handler.IgnoreBelow(12)
err = handler.ReceivedPacket(11, time.Time{}, false)
Expect(err).ToNot(HaveOccurred())
ack = handler.GetAckFrame()
Expect(ack).To(BeNil())
})
It("doesn't queue an ACK if the packet closes a gap that was not yet reported", func() {
receiveAndAckPacketsUntilAckDecimation()
p := protocol.PacketNumber(minReceivedBeforeAckDecimation + 1)