limit number of packets stored in SentPacketHandler

fixes #140
This commit is contained in:
Marten Seemann
2016-05-24 16:06:48 +07:00
parent 931687e9a4
commit e2254f1bbd
7 changed files with 52 additions and 2 deletions

View File

@@ -162,6 +162,20 @@ var _ = Describe("SentPacketHandler", func() {
})
})
Context("DOS mitigation", func() {
It("checks the size of the packet history, for unacked packets", func() {
for i := uint32(1); i < protocol.MaxTrackedSentPackets+10; i++ {
packet := Packet{PacketNumber: protocol.PacketNumber(i), Frames: []frames.Frame{&streamFrame}, Length: 1}
err := handler.SentPacket(&packet)
Expect(err).ToNot(HaveOccurred())
}
err := handler.CheckForError()
Expect(err).To(MatchError(ErrTooManyTrackedSentPackets))
})
// TODO: add a test that the length of the retransmission queue is considered, even if packets have already been ACKed. Relevant once we drop support for QUIC 33 and earlier
})
Context("ACK entropy calculations", func() {
var packets []*Packet
var entropy EntropyAccumulator