mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
use the peer's max_packet_size when packing packets
This commit is contained in:
parent
0f401b0b37
commit
9d18d30931
4 changed files with 44 additions and 1 deletions
|
@ -895,7 +895,6 @@ var _ = Describe("Packet packer", func() {
|
|||
Expect(sf2.StreamID).To(Equal(protocol.StreamID(5)))
|
||||
Expect(sf2.DataLenPresent).To(BeFalse())
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Context("packing ACK packets", func() {
|
||||
|
@ -917,4 +916,38 @@ var _ = Describe("Packet packer", func() {
|
|||
}))
|
||||
})
|
||||
})
|
||||
|
||||
Context("max packet size", func() {
|
||||
It("sets the maximum packet size", func() {
|
||||
for i := 0; i < 10*int(maxPacketSize); i++ {
|
||||
packer.QueueControlFrame(&wire.PingFrame{})
|
||||
}
|
||||
mockStreamFramer.EXPECT().HasCryptoStreamData().AnyTimes()
|
||||
mockStreamFramer.EXPECT().PopStreamFrames(gomock.Any()).AnyTimes()
|
||||
p, err := packer.PackPacket()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(p.raw).To(HaveLen(int(maxPacketSize)))
|
||||
// now reduce the maxPacketSize
|
||||
packer.SetMaxPacketSize(maxPacketSize - 10)
|
||||
p, err = packer.PackPacket()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(p.raw).To(HaveLen(int(maxPacketSize) - 10))
|
||||
})
|
||||
|
||||
It("doesn't increase the max packet size", func() {
|
||||
for i := 0; i < 10*int(maxPacketSize); i++ {
|
||||
packer.QueueControlFrame(&wire.PingFrame{})
|
||||
}
|
||||
mockStreamFramer.EXPECT().HasCryptoStreamData().AnyTimes()
|
||||
mockStreamFramer.EXPECT().PopStreamFrames(gomock.Any()).AnyTimes()
|
||||
p, err := packer.PackPacket()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(p.raw).To(HaveLen(int(maxPacketSize)))
|
||||
// now try to increase the maxPacketSize
|
||||
packer.SetMaxPacketSize(maxPacketSize + 10)
|
||||
p, err = packer.PackPacket()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(p.raw).To(HaveLen(int(maxPacketSize)))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue