Http2MessageBody.TryRead TryStart/TryStop (#13464)
This commit is contained in:
parent
b9d1e067ee
commit
649bcc8f61
|
|
@ -69,11 +69,23 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
|
||||||
|
|
||||||
public override bool TryRead(out ReadResult readResult)
|
public override bool TryRead(out ReadResult readResult)
|
||||||
{
|
{
|
||||||
var result = _context.RequestBodyPipe.Reader.TryRead(out readResult);
|
TryStart();
|
||||||
_readResult = readResult;
|
|
||||||
CountBytesRead(readResult.Buffer.Length);
|
|
||||||
|
|
||||||
return result;
|
var hasResult = _context.RequestBodyPipe.Reader.TryRead(out readResult);
|
||||||
|
|
||||||
|
if (hasResult)
|
||||||
|
{
|
||||||
|
_readResult = readResult;
|
||||||
|
|
||||||
|
CountBytesRead(readResult.Buffer.Length);
|
||||||
|
|
||||||
|
if (readResult.IsCompleted)
|
||||||
|
{
|
||||||
|
TryStop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hasResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async ValueTask<ReadResult> ReadAsync(CancellationToken cancellationToken = default)
|
public override async ValueTask<ReadResult> ReadAsync(CancellationToken cancellationToken = default)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue