keep increasing the packet number after version negotiation and retry

This commit is contained in:
Marten Seemann 2018-12-22 22:15:35 +06:30
parent 1abf9e1b37
commit 178ac0dacb
8 changed files with 59 additions and 13 deletions

View file

@ -49,7 +49,7 @@ var _ = Describe("SentPacketHandler", func() {
BeforeEach(func() {
rttStats := &congestion.RTTStats{}
handler = NewSentPacketHandler(rttStats, utils.DefaultLogger).(*sentPacketHandler)
handler = NewSentPacketHandler(42, rttStats, utils.DefaultLogger).(*sentPacketHandler)
handler.SetHandshakeComplete()
streamFrame = wire.StreamFrame{
StreamID: 5,
@ -962,4 +962,17 @@ var _ = Describe("SentPacketHandler", func() {
Expect(packet).To(BeNil())
})
})
Context("peeking and popping packet number", func() {
It("peeks and pops the initial packet number", func() {
pn, _ := handler.PeekPacketNumber()
Expect(pn).To(Equal(protocol.PacketNumber(42)))
Expect(handler.PopPacketNumber()).To(Equal(protocol.PacketNumber(42)))
})
It("peeks and pops beyond the initial packet number", func() {
Expect(handler.PopPacketNumber()).To(Equal(protocol.PacketNumber(42)))
Expect(handler.PopPacketNumber()).To(BeNumerically(">", 42))
})
})
})