From 1ccf2c3bff5fc13d20ea5c78f3697311e539893e Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 28 Dec 2024 17:09:14 +0800 Subject: [PATCH] fix accounting for lost RESET_STREAM frames in the send stream (#4804) --- send_stream.go | 1 + send_stream_test.go | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/send_stream.go b/send_stream.go index 1a09eec9..78b1c902 100644 --- a/send_stream.go +++ b/send_stream.go @@ -597,6 +597,7 @@ func (s *sendStreamResetStreamHandler) OnAcked(wire.Frame) { func (s *sendStreamResetStreamHandler) OnLost(wire.Frame) { s.mutex.Lock() s.queuedResetStreamFrame = true + s.numOutstandingFrames-- s.mutex.Unlock() s.sender.onHasStreamControlFrame(s.streamID, (*sendStream)(s)) } diff --git a/send_stream_test.go b/send_stream_test.go index a5638c07..62b2a44c 100644 --- a/send_stream_test.go +++ b/send_stream_test.go @@ -741,7 +741,7 @@ func TestSendStreamCancellationResetStreamRetransmission(t *testing.T) { require.False(t, hasMore) require.True(t, mockCtrl.Satisfied()) - // lose the frame + // lose the RESET_STREAM frame mockSender.EXPECT().onHasStreamControlFrame(streamID, str) f1.Handler.OnLost(f1.Frame) // get the retransmission @@ -751,9 +751,8 @@ func TestSendStreamCancellationResetStreamRetransmission(t *testing.T) { require.False(t, hasMore) require.True(t, mockCtrl.Satisfied()) - // acknowledge the frame - // TODO(#4803): this should complete the stream, if we correctly accounted for lost RESET_STREAM frames - // mockSender.EXPECT().onStreamCompleted(streamID) + // acknowledging the RESET_STREAM frame completes the stream + mockSender.EXPECT().onStreamCompleted(streamID) f2.Handler.OnAcked(f2.Frame) }