mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 04:37:36 +03:00
move cutting of coalesced packets to the wire package
This commit is contained in:
parent
9f5b96f3be
commit
28ed85b9c6
11 changed files with 173 additions and 107 deletions
|
@ -25,10 +25,14 @@ var _ = Describe("Packet Unpacker", func() {
|
|||
|
||||
getHeader := func(extHdr *wire.ExtendedHeader) (*wire.Header, []byte) {
|
||||
buf := &bytes.Buffer{}
|
||||
Expect(extHdr.Write(buf, protocol.VersionWhatever)).To(Succeed())
|
||||
hdr, err := wire.ParseHeader(bytes.NewReader(buf.Bytes()), connID.Len())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
return hdr, buf.Bytes()
|
||||
ExpectWithOffset(1, extHdr.Write(buf, protocol.VersionWhatever)).To(Succeed())
|
||||
hdrLen := buf.Len()
|
||||
if extHdr.Length > protocol.ByteCount(extHdr.PacketNumberLen) {
|
||||
buf.Write(make([]byte, int(extHdr.Length)-int(extHdr.PacketNumberLen)))
|
||||
}
|
||||
hdr, _, _, err := wire.ParsePacket(buf.Bytes(), connID.Len())
|
||||
ExpectWithOffset(1, err).ToNot(HaveOccurred())
|
||||
return hdr, buf.Bytes()[:hdrLen]
|
||||
}
|
||||
|
||||
BeforeEach(func() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue