mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 20:57:36 +03:00
accept duplicate and delayed packets
We used to reject duplicate and packets with packet numbers lower than the LeastUnacked we received in a STOP_WAITING frame, because we didn't accept overlapping stream data. For all other frames, duplicates never were an issue. Now that we accept overlapping stream data, there's no need to reject those packets, in fact, processing a delayed packet will be beneficial for performance.
This commit is contained in:
parent
94843e1919
commit
14fa2dc7dd
4 changed files with 20 additions and 53 deletions
|
@ -40,24 +40,6 @@ var _ = Describe("receivedPacketHandler", func() {
|
|||
Expect(err).To(MatchError(errInvalidPacketNumber))
|
||||
})
|
||||
|
||||
It("rejects a duplicate package", func() {
|
||||
for i := 1; i < 5; i++ {
|
||||
err := handler.ReceivedPacket(protocol.PacketNumber(i), true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
}
|
||||
err := handler.ReceivedPacket(4, true)
|
||||
Expect(err).To(MatchError(ErrDuplicatePacket))
|
||||
})
|
||||
|
||||
It("ignores a packet with PacketNumber less than the LeastUnacked of a previously received StopWaiting", func() {
|
||||
err := handler.ReceivedPacket(5, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = handler.ReceivedStopWaiting(&frames.StopWaitingFrame{LeastUnacked: 10})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = handler.ReceivedPacket(9, true)
|
||||
Expect(err).To(MatchError(ErrPacketSmallerThanLastStopWaiting))
|
||||
})
|
||||
|
||||
It("does not ignore a packet with PacketNumber equal to LeastUnacked of a previously received StopWaiting", func() {
|
||||
err := handler.ReceivedPacket(5, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
@ -274,6 +256,19 @@ var _ = Describe("receivedPacketHandler", func() {
|
|||
Expect(ack.AckRanges[1]).To(Equal(frames.AckRange{FirstPacketNumber: 1, LastPacketNumber: 1}))
|
||||
})
|
||||
|
||||
It("doesn't add delayed packets to the packetHistory", func() {
|
||||
err := handler.ReceivedStopWaiting(&frames.StopWaitingFrame{LeastUnacked: protocol.PacketNumber(6)})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = handler.ReceivedPacket(4, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = handler.ReceivedPacket(10, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
ack := handler.GetAckFrame()
|
||||
Expect(ack).ToNot(BeNil())
|
||||
Expect(ack.LargestAcked).To(Equal(protocol.PacketNumber(10)))
|
||||
Expect(ack.LowestAcked).To(Equal(protocol.PacketNumber(10)))
|
||||
})
|
||||
|
||||
It("deletes packets from the packetHistory after receiving a StopWaiting, after continuously received packets", func() {
|
||||
for i := 1; i <= 12; i++ {
|
||||
err := handler.ReceivedPacket(protocol.PacketNumber(i), true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue