Correctly copy frame payload in frame sorter

This commit is contained in:
Andy Wang 2020-12-28 00:48:41 +00:00
parent f322f8b47f
commit 661db9d083
No known key found for this signature in database
GPG Key ID: 181B49F9F38F3374
1 changed files with 2 additions and 0 deletions

View File

@ -82,6 +82,8 @@ func (sb *streamBuffer) Write(f *Frame) (toBeClosed bool, err error) {
}
saved := *f
saved.Payload = make([]byte, len(f.Payload))
copy(saved.Payload, f.Payload)
heap.Push(&sb.sh, &saved)
// Keep popping from the heap until empty or to the point that the wanted seq was not received
for len(sb.sh) > 0 && sb.sh[0].Seq == sb.nextRecvSeq {