Skip to content

Commit 2b6d776

Browse files
committed
Fix fragmentation bug
1 parent d3dd42b commit 2b6d776

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

internal/socket/duplex.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,10 +1092,20 @@ func (dc *DuplexConnection) sendPayload(
10921092
}
10931093
dc.doSplit(d, m, func(index int, result fragmentation.SplitResult) {
10941094
flag := result.Flag
1095+
isLastFragment := !result.Flag.Check(core.FlagFollow)
1096+
10951097
if index == 0 {
10961098
flag |= frameFlag
1099+
// Remove (C)omplete flag, unless this is the last fragment.
1100+
if !isLastFragment {
1101+
flag &^= core.FlagComplete
1102+
}
10971103
} else {
10981104
flag |= core.FlagNext
1105+
// Set (C)omplete flag, if the original frame had it and this is the last fragment.
1106+
if isLastFragment && frameFlag.Check(core.FlagComplete) {
1107+
flag |= core.FlagComplete
1108+
}
10991109
}
11001110

11011111
// lazy release at last frame

0 commit comments

Comments
 (0)