mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 04:37:36 +03:00
implement a function to pack MTU probe packets
This commit is contained in:
parent
91a314258d
commit
fb5a45ac53
2 changed files with 55 additions and 24 deletions
|
@ -1439,6 +1439,21 @@ var _ = Describe("Packet packer", func() {
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(packet).To(BeNil())
|
||||
})
|
||||
|
||||
It("packs an MTU probe packet", func() {
|
||||
sealingManager.EXPECT().Get1RTTSealer().Return(getSealer(), nil)
|
||||
pnManager.EXPECT().PeekPacketNumber(protocol.Encryption1RTT).Return(protocol.PacketNumber(0x43), protocol.PacketNumberLen2)
|
||||
pnManager.EXPECT().PopPacketNumber(protocol.Encryption1RTT).Return(protocol.PacketNumber(0x43))
|
||||
ping := ackhandler.Frame{Frame: &wire.PingFrame{}}
|
||||
const probePacketSize = maxPacketSize + 42
|
||||
p, err := packer.PackMTUProbePacket(ping, probePacketSize)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(p.length).To(BeEquivalentTo(probePacketSize))
|
||||
Expect(p.header.IsLongHeader).To(BeFalse())
|
||||
Expect(p.header.PacketNumber).To(Equal(protocol.PacketNumber(0x43)))
|
||||
Expect(p.EncryptionLevel()).To(Equal(protocol.Encryption1RTT))
|
||||
Expect(p.buffer.Data).To(HaveLen(int(probePacketSize)))
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue