calculate correct MinLength of an ACK frame with a contiguous NACK range

fixes #183
This commit is contained in:
Marten Seemann
2016-06-20 14:43:00 +07:00
parent 29029978a0
commit 433920fc15
2 changed files with 29 additions and 13 deletions

View File

@@ -512,7 +512,7 @@ var _ = Describe("AckFrame", func() {
Expect(f.MinLength(0)).To(Equal(protocol.ByteCount(b.Len())))
})
It("has proper min length with nack ranges", func() {
It("has proper min length with NACK ranges", func() {
f := &AckFrame{
Entropy: 2,
LargestObserved: 4,
@@ -522,6 +522,17 @@ var _ = Describe("AckFrame", func() {
Expect(err).ToNot(HaveOccurred())
Expect(f.MinLength(0)).To(Equal(protocol.ByteCount(b.Len())))
})
It("has proper min length with a continuous NACK ranges", func() {
f := &AckFrame{
Entropy: 2,
LargestObserved: 3000,
NackRanges: []NackRange{{FirstPacketNumber: 2, LastPacketNumber: 2000}},
}
err := f.Write(b, protocol.Version31)
Expect(err).ToNot(HaveOccurred())
Expect(f.MinLength(0)).To(Equal(protocol.ByteCount(b.Len())))
})
})
})