forked from quic-go/quic-go
fix calculation of the length of appended STREAM frames
For the last STREAM frame we omit the Length field. When packing STREAM frames, we need to account for this byte saving when calculating the length of the payload.
This commit is contained in:
@@ -114,7 +114,11 @@ func (f *framerI) AppendStreamFrames(frames []wire.Frame, maxLen protocol.ByteCo
|
||||
}
|
||||
f.mutex.Unlock()
|
||||
if frameAdded {
|
||||
frames[len(frames)-1].(*wire.StreamFrame).DataLenPresent = false
|
||||
lastFrame := frames[len(frames)-1].(*wire.StreamFrame)
|
||||
lastFrameLen := lastFrame.Length(f.version)
|
||||
// acount for the smaller size of the last STREAM frame
|
||||
lastFrame.DataLenPresent = false
|
||||
length += lastFrame.Length(f.version) - lastFrameLen
|
||||
}
|
||||
return frames, length
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user