use a sync.Pool for ackhandler.Frames (#3656)

This commit is contained in:
Marten Seemann 2023-01-17 23:15:02 -08:00 committed by GitHub
parent b77d8570df
commit 2aa71ff76b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 129 additions and 90 deletions

View file

@ -64,7 +64,7 @@ var _ = Describe("Framer", func() {
ping := &wire.PingFrame{}
mdf := &wire.MaxDataFrame{MaximumData: 0x42}
framer.QueueControlFrame(mdf)
frames, length := framer.AppendControlFrames([]ackhandler.Frame{{Frame: ping}}, 1000)
frames, length := framer.AppendControlFrames([]*ackhandler.Frame{{Frame: ping}}, 1000)
Expect(frames).To(HaveLen(2))
Expect(frames[0].Frame).To(Equal(ping))
Expect(frames[1].Frame).To(Equal(mdf))
@ -161,7 +161,7 @@ var _ = Describe("Framer", func() {
stream1.EXPECT().popStreamFrame(gomock.Any()).Return(&ackhandler.Frame{Frame: f}, false)
framer.AddActiveStream(id1)
mdf := &wire.MaxDataFrame{MaximumData: 1337}
frames := []ackhandler.Frame{{Frame: mdf}}
frames := []*ackhandler.Frame{{Frame: mdf}}
fs, length := framer.AppendStreamFrames(frames, 1000)
Expect(fs).To(HaveLen(2))
Expect(fs[0].Frame).To(Equal(mdf))