optimize packing of STREAM_DATA_BLOCKED frames (#4801)

* refactor the framer to pack both control and STREAM frames

* refactor framer STREAM frame packing logic

* pack STREAM_DATA_BLOCKED in the same packet as the STREAM frame

This makes debugging easier (and is slightly more efficient). In the
pathological case where there is not enough space remaning in the packet
to pack the STREAM_DATA_BLOCKED frame, it is queued for the next packet.

* add an integration test
This commit is contained in:
Marten Seemann
2025-01-07 12:06:00 +08:00
committed by GitHub
parent 4ab8ec49d1
commit 3cb5f3e104
13 changed files with 426 additions and 293 deletions

View File

@@ -69,7 +69,7 @@ func TestStreamCompletion(t *testing.T) {
require.NoError(t, str.Close())
mockFC.EXPECT().SendWindowSize().Return(protocol.MaxByteCount)
mockFC.EXPECT().AddBytesSent(protocol.ByteCount(6))
f, _ := str.popStreamFrame(protocol.MaxByteCount, protocol.Version1)
f, _, _ := str.popStreamFrame(protocol.MaxByteCount, protocol.Version1)
require.NotNil(t, f.Frame)
require.True(t, f.Frame.Fin)
f.Handler.OnAcked(f.Frame)