forked from quic-go/quic-go
fix byte length calculation for split frames in StreamFrameQueue
This commit is contained in:
@@ -69,7 +69,7 @@ func (q *streamFrameQueue) Pop(maxLength protocol.ByteCount) *frames.StreamFrame
|
||||
splitFrame := q.maybeSplitOffFrame(frame, maxLength)
|
||||
|
||||
if splitFrame != nil { // StreamFrame was split
|
||||
q.byteLen -= protocol.ByteCount(len(frame.Data))
|
||||
q.byteLen -= protocol.ByteCount(len(splitFrame.Data))
|
||||
return splitFrame
|
||||
}
|
||||
|
||||
|
||||
@@ -205,10 +205,11 @@ var _ = Describe("streamFrameQueue", func() {
|
||||
})
|
||||
|
||||
It("correctly calculates the byte length when returning a split frame", func() {
|
||||
queue.Push(prioFrame1, true)
|
||||
queue.Push(frame1, false)
|
||||
queue.Push(frame2, false)
|
||||
startByteLength := queue.ByteLen()
|
||||
frame := queue.Pop(6)
|
||||
Expect(frame.StreamID).To(Equal(frame1.StreamID)) // make sure the right frame was popped
|
||||
Expect(queue.ByteLen()).To(Equal(startByteLength - protocol.ByteCount(len(frame.Data))))
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user