efficiently calculate the byte length of the StreamFrameQueue

fixes #146
This commit is contained in:
Marten Seemann
2016-05-26 11:40:38 +07:00
parent 758334f6aa
commit 91b4bdffd9
2 changed files with 15 additions and 11 deletions

View File

@@ -197,6 +197,14 @@ var _ = Describe("streamFrameQueue", func() {
copy(data[len(frame.Data):], nextframe.Data)
Expect(data).To(Equal(origdata))
})
It("correctly calculates the byte length when returning a split frame", func() {
queue.Push(prioFrame1, true)
queue.Push(frame1, false)
startByteLength := queue.ByteLen()
frame := queue.Pop(6)
Expect(queue.ByteLen()).To(Equal(startByteLength - protocol.ByteCount(len(frame.Data))))
})
})
})