Skip to content

Commit

Permalink
Respond to feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
wtgodbe committed Apr 13, 2021
1 parent b147ac7 commit a9a5619
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public override void AdvanceTo(SequencePosition consumed, SequencePosition exami

public override bool TryReadInternal(out ReadResult readResult)
{
Task startTask = TryStartAsync();
Debug.Assert(startTask.IsCompleted);
TryStartAsync();

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

Expand Down
12 changes: 5 additions & 7 deletions src/Servers/Kestrel/Core/src/Internal/Http/MessageBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,7 @@ protected Task TryStartAsync()
}
}

Task readTask = OnReadStartedAsync();
if (!readTask.IsCompletedSuccessfully)
{
return readTask;
}

return Task.CompletedTask;
return OnReadStartedAsync();
}

protected void TryStop()
Expand Down Expand Up @@ -207,6 +201,10 @@ protected ValueTask<ReadResult> StartTimingReadAsync(ValueTask<ReadResult> readA
{
return StartTimingReadAwaited(continueTask, readAwaitable, cancellationToken);
}
else
{
continueTask.GetAwaiter().GetResult();
}

if (_timingEnabled)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;

namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
Expand Down Expand Up @@ -39,7 +40,7 @@ protected override Task OnReadStartedAsync()
ValueTask<FlushResult> continueTask = TryProduceContinueAsync();
if (!continueTask.IsCompletedSuccessfully)
{
return continueTask.AsTask();
return continueTask.GetAsTask();
}
}

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

public override bool TryRead(out ReadResult readResult)
{
Task startTask = TryStartAsync();
Debug.Assert(startTask.IsCompleted);
TryStartAsync();

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

Expand Down

0 comments on commit a9a5619

Please sign in to comment.