introduce a buffer pool for large buffers (20k)

This commit is contained in:
Marten Seemann 2023-04-19 09:58:54 +02:00
parent bef0f3d31a
commit 7d8db149b6
5 changed files with 35 additions and 15 deletions

View file

@ -9,13 +9,17 @@ import (
var _ = Describe("Buffer Pool", func() {
It("returns buffers of cap", func() {
buf := getPacketBuffer()
Expect(buf.Data).To(HaveCap(int(protocol.MaxPacketBufferSize)))
buf1 := getPacketBuffer()
Expect(buf1.Data).To(HaveCap(protocol.MaxPacketBufferSize))
buf2 := getLargePacketBuffer()
Expect(buf2.Data).To(HaveCap(protocol.MaxLargePacketBufferSize))
})
It("releases buffers", func() {
buf := getPacketBuffer()
buf.Release()
buf1 := getPacketBuffer()
buf1.Release()
buf2 := getLargePacketBuffer()
buf2.Release()
})
It("gets the length", func() {