fix bug in OutgoingPacketAckHandler entropy calculation for simple ACKs

This commit is contained in:
Marten Seemann
2016-04-23 10:57:44 +07:00
parent a9c00a4303
commit 50d38eac39
2 changed files with 30 additions and 17 deletions

View File

@@ -160,6 +160,25 @@ var _ = Describe("AckHandler", func() {
err = handler.ReceivedAck(&ack)
Expect(err).ToNot(HaveOccurred())
})
It("checks the entropy of an ACK after a previous ACK was already received", func() {
expectedEntropy := EntropyAccumulator(0)
expectedEntropy.Add(1, packets[0].EntropyBit)
ack := frames.AckFrame{
LargestObserved: 1,
Entropy: byte(expectedEntropy),
}
err := handler.ReceivedAck(&ack)
Expect(err).ToNot(HaveOccurred())
expectedEntropy.Add(2, packets[1].EntropyBit)
expectedEntropy.Add(3, packets[2].EntropyBit)
ack = frames.AckFrame{
LargestObserved: 3,
Entropy: byte(expectedEntropy),
}
err = handler.ReceivedAck(&ack)
Expect(err).ToNot(HaveOccurred())
})
})
Context("ACKs with NACK ranges", func() {
@@ -244,7 +263,7 @@ var _ = Describe("AckHandler", func() {
Expect(handler.packetHistory).To(HaveKey(protocol.PacketNumber(2)))
})
It("checks the entropy of an ACK with a NACK after an previous ACK was already received", func() {
It("checks the entropy of an ACK with a NACK after a previous ACK was already received", func() {
expectedEntropy := EntropyAccumulator(0)
expectedEntropy.Add(1, packets[0].EntropyBit)
ack := frames.AckFrame{