implement a buffer pool for STREAM frames

This commit is contained in:
Marten Seemann
2019-09-04 16:45:39 +07:00
parent 326ec9e16e
commit 5ea33cd31e
70 changed files with 193 additions and 48 deletions

View File

@@ -0,0 +1,24 @@
package wire
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Pool", func() {
It("gets and puts STREAM frames", func() {
f := getStreamFrame()
putStreamFrame(f)
})
It("panics when putting a STREAM frame with a wrong capacity", func() {
f := getStreamFrame()
f.Data = []byte("foobar")
Expect(func() { putStreamFrame(f) }).To(Panic())
})
It("accepts STREAM frames not from the buffer, but ignores them", func() {
f := &StreamFrame{Data: []byte("foobar")}
putStreamFrame(f)
})
})