@@ -28,7 +28,7 @@ internal class Http2OutputProducer : IHttpOutputProducer, IHttpOutputAborter, ID
28
28
private IMemoryOwner < byte > ? _fakeMemoryOwner ;
29
29
private byte [ ] ? _fakeMemory ;
30
30
private bool _startedWritingDataFrames ;
31
- private bool _streamCompleted ;
31
+ private bool _completeScheduled ;
32
32
private bool _suffixSent ;
33
33
private bool _appCompletedWithNoResponseBodyOrTrailers ;
34
34
private bool _writerComplete ;
@@ -176,7 +176,7 @@ public void StreamReset(uint initialWindowSize)
176
176
_appCompletedWithNoResponseBodyOrTrailers = false ;
177
177
_suffixSent = false ;
178
178
_startedWritingDataFrames = false ;
179
- _streamCompleted = false ;
179
+ _completeScheduled = false ;
180
180
_writerComplete = false ;
181
181
_pipe . Reset ( ) ;
182
182
_pipeWriter . Reset ( ) ;
@@ -205,7 +205,7 @@ public void Complete()
205
205
206
206
Stop ( ) ;
207
207
208
- if ( ! _streamCompleted )
208
+ if ( ! _completeScheduled )
209
209
{
210
210
EnqueueStateUpdate ( State . Completed ) ;
211
211
@@ -256,7 +256,8 @@ public ValueTask<FlushResult> FlushAsync(CancellationToken cancellationToken)
256
256
lock ( _dataWriterLock )
257
257
{
258
258
ThrowIfSuffixSentOrCompleted ( ) ;
259
- if ( _streamCompleted )
259
+
260
+ if ( _completeScheduled )
260
261
{
261
262
return new ValueTask < FlushResult > ( new FlushResult ( false , true ) ) ;
262
263
}
@@ -317,7 +318,7 @@ public ValueTask<FlushResult> Write100ContinueAsync()
317
318
{
318
319
ThrowIfSuffixSentOrCompleted ( ) ;
319
320
320
- if ( _streamCompleted )
321
+ if ( _completeScheduled )
321
322
{
322
323
return default ;
323
324
}
@@ -332,7 +333,7 @@ public void WriteResponseHeaders(int statusCode, string? reasonPhrase, HttpRespo
332
333
{
333
334
// The HPACK header compressor is stateful, if we compress headers for an aborted stream we must send them.
334
335
// Optimize for not compressing or sending them.
335
- if ( _streamCompleted )
336
+ if ( _completeScheduled )
336
337
{
337
338
return ;
338
339
}
@@ -366,7 +367,7 @@ public Task WriteDataAsync(ReadOnlySpan<byte> data, CancellationToken cancellati
366
367
367
368
// This length check is important because we don't want to set _startedWritingDataFrames unless a data
368
369
// frame will actually be written causing the headers to be flushed.
369
- if ( _streamCompleted || data . Length == 0 )
370
+ if ( _completeScheduled || data . Length == 0 )
370
371
{
371
372
return Task . CompletedTask ;
372
373
}
@@ -389,12 +390,12 @@ public ValueTask<FlushResult> WriteStreamSuffixAsync()
389
390
{
390
391
lock ( _dataWriterLock )
391
392
{
392
- if ( _streamCompleted )
393
+ if ( _completeScheduled )
393
394
{
394
395
return ValueTask . FromResult < FlushResult > ( default ) ;
395
396
}
396
397
397
- _streamCompleted = true ;
398
+ _completeScheduled = true ;
398
399
_suffixSent = true ;
399
400
400
401
EnqueueStateUpdate ( State . Completed ) ;
@@ -413,7 +414,7 @@ public ValueTask<FlushResult> WriteRstStreamAsync(Http2ErrorCode error)
413
414
{
414
415
Stop ( ) ;
415
416
// We queued the stream to complete but didn't complete the response yet
416
- if ( _streamCompleted && ! _completedResponse )
417
+ if ( _completeScheduled && ! _completedResponse )
417
418
{
418
419
// Set the error so that we can write the RST when the response completes.
419
420
_resetErrorCode = error ;
@@ -430,7 +431,7 @@ public void Advance(int bytes)
430
431
{
431
432
ThrowIfSuffixSentOrCompleted ( ) ;
432
433
433
- if ( _streamCompleted )
434
+ if ( _completeScheduled )
434
435
{
435
436
return ;
436
437
}
@@ -449,7 +450,7 @@ public Span<byte> GetSpan(int sizeHint = 0)
449
450
{
450
451
ThrowIfSuffixSentOrCompleted ( ) ;
451
452
452
- if ( _streamCompleted )
453
+ if ( _completeScheduled )
453
454
{
454
455
return GetFakeMemory ( sizeHint ) . Span ;
455
456
}
@@ -464,7 +465,7 @@ public Memory<byte> GetMemory(int sizeHint = 0)
464
465
{
465
466
ThrowIfSuffixSentOrCompleted ( ) ;
466
467
467
- if ( _streamCompleted )
468
+ if ( _completeScheduled )
468
469
{
469
470
return GetFakeMemory ( sizeHint ) ;
470
471
}
@@ -477,7 +478,7 @@ public void CancelPendingFlush()
477
478
{
478
479
lock ( _dataWriterLock )
479
480
{
480
- if ( _streamCompleted )
481
+ if ( _completeScheduled )
481
482
{
482
483
return ;
483
484
}
@@ -499,7 +500,7 @@ public ValueTask<FlushResult> WriteDataToPipeAsync(ReadOnlySpan<byte> data, Canc
499
500
500
501
// This length check is important because we don't want to set _startedWritingDataFrames unless a data
501
502
// frame will actually be written causing the headers to be flushed.
502
- if ( _streamCompleted || data . Length == 0 )
503
+ if ( _completeScheduled || data . Length == 0 )
503
504
{
504
505
return new ValueTask < FlushResult > ( new FlushResult ( false , true ) ) ;
505
506
}
@@ -543,14 +544,14 @@ public void Stop()
543
544
{
544
545
_waitingForWindowUpdates = false ;
545
546
546
- if ( _streamCompleted && _completedResponse )
547
+ if ( _completeScheduled && _completedResponse )
547
548
{
548
549
// We can overschedule as long as we haven't yet completed the response. This is important because
549
550
// we may need to abort the stream if it's waiting for a window update.
550
551
return ;
551
552
}
552
553
553
- _streamCompleted = true ;
554
+ _completeScheduled = true ;
554
555
555
556
EnqueueStateUpdate ( State . Aborted ) ;
556
557
0 commit comments