mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-05 21:27:35 +03:00
implement packet pacing
This commit is contained in:
parent
c3cc35363b
commit
5ef89733ae
10 changed files with 153 additions and 50 deletions
|
@ -741,28 +741,36 @@ var _ = Describe("SentPacketHandler", func() {
|
|||
})
|
||||
|
||||
It("allows or denies sending based on congestion", func() {
|
||||
Expect(handler.retransmissionQueue).To(BeEmpty())
|
||||
handler.bytesInFlight = 100
|
||||
cong.EXPECT().GetCongestionWindow().Return(protocol.MaxByteCount)
|
||||
cong.EXPECT().GetCongestionWindow().Return(protocol.ByteCount(200))
|
||||
Expect(handler.SendingAllowed()).To(BeTrue())
|
||||
cong.EXPECT().GetCongestionWindow().Return(protocol.ByteCount(0))
|
||||
cong.EXPECT().GetCongestionWindow().Return(protocol.ByteCount(75))
|
||||
Expect(handler.SendingAllowed()).To(BeFalse())
|
||||
})
|
||||
|
||||
It("allows or denies sending based on the number of tracked packets", func() {
|
||||
cong.EXPECT().GetCongestionWindow().Return(protocol.MaxByteCount).AnyTimes()
|
||||
cong.EXPECT().GetCongestionWindow().Times(2)
|
||||
Expect(handler.SendingAllowed()).To(BeTrue())
|
||||
handler.retransmissionQueue = make([]*Packet, protocol.MaxTrackedSentPackets)
|
||||
Expect(handler.SendingAllowed()).To(BeFalse())
|
||||
})
|
||||
|
||||
It("allows sending if there are retransmisisons outstanding", func() {
|
||||
cong.EXPECT().GetCongestionWindow().Times(2)
|
||||
handler.bytesInFlight = 100
|
||||
cong.EXPECT().GetCongestionWindow().Return(protocol.ByteCount(0)).AnyTimes()
|
||||
Expect(handler.retransmissionQueue).To(BeEmpty())
|
||||
Expect(handler.SendingAllowed()).To(BeFalse())
|
||||
handler.retransmissionQueue = []*Packet{nil}
|
||||
handler.retransmissionQueue = []*Packet{{PacketNumber: 3}}
|
||||
Expect(handler.SendingAllowed()).To(BeTrue())
|
||||
})
|
||||
|
||||
It("gets the pacing delay", func() {
|
||||
cong.EXPECT().OnPacketSent(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any())
|
||||
handler.SentPacket(&Packet{PacketNumber: 1})
|
||||
handler.bytesInFlight = protocol.ByteCount(100)
|
||||
cong.EXPECT().TimeUntilSend(handler.bytesInFlight).Return(time.Hour)
|
||||
Expect(handler.TimeUntilSend()).To(BeTemporally("~", time.Now().Add(time.Hour), time.Second))
|
||||
})
|
||||
})
|
||||
|
||||
Context("calculating RTO", func() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue