Skip to content

Commit a9a5619

Browse files
committed
Respond to feedback
1 parent b147ac7 commit a9a5619

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

src/Servers/Kestrel/Core/src/Internal/Http/Http1ChunkedEncodingMessageBody.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ public override void AdvanceTo(SequencePosition consumed, SequencePosition exami
4444

4545
public override bool TryReadInternal(out ReadResult readResult)
4646
{
47-
Task startTask = TryStartAsync();
48-
Debug.Assert(startTask.IsCompleted);
47+
TryStartAsync();
4948

5049
var boolResult = _requestBodyPipe.Reader.TryRead(out _readResult);
5150

src/Servers/Kestrel/Core/src/Internal/Http/MessageBody.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,7 @@ protected Task TryStartAsync()
140140
}
141141
}
142142

143-
Task readTask = OnReadStartedAsync();
144-
if (!readTask.IsCompletedSuccessfully)
145-
{
146-
return readTask;
147-
}
148-
149-
return Task.CompletedTask;
143+
return OnReadStartedAsync();
150144
}
151145

152146
protected void TryStop()
@@ -207,6 +201,10 @@ protected ValueTask<ReadResult> StartTimingReadAsync(ValueTask<ReadResult> readA
207201
{
208202
return StartTimingReadAwaited(continueTask, readAwaitable, cancellationToken);
209203
}
204+
else
205+
{
206+
continueTask.GetAwaiter().GetResult();
207+
}
210208

211209
if (_timingEnabled)
212210
{

src/Servers/Kestrel/Core/src/Internal/Http2/Http2MessageBody.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Threading;
88
using System.Threading.Tasks;
99
using Microsoft.AspNetCore.Connections;
10+
using Microsoft.AspNetCore.Internal;
1011
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
1112

1213
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
@@ -39,7 +40,7 @@ protected override Task OnReadStartedAsync()
3940
ValueTask<FlushResult> continueTask = TryProduceContinueAsync();
4041
if (!continueTask.IsCompletedSuccessfully)
4142
{
42-
return continueTask.AsTask();
43+
return continueTask.GetAsTask();
4344
}
4445
}
4546

@@ -66,8 +67,7 @@ public override void AdvanceTo(SequencePosition consumed, SequencePosition exami
6667

6768
public override bool TryRead(out ReadResult readResult)
6869
{
69-
Task startTask = TryStartAsync();
70-
Debug.Assert(startTask.IsCompleted);
70+
TryStartAsync();
7171

7272
var hasResult = _context.RequestBodyPipe.Reader.TryRead(out readResult);
7373

0 commit comments

Comments
 (0)