Consume in single call

This commit is contained in:
Ben Adams 2015-11-15 21:33:31 +00:00
parent f48e6ba51a
commit f089abd337
2 changed files with 16 additions and 16 deletions

View File

@ -232,10 +232,8 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
await ProduceEnd();
while (await MessageBody.SkipAsync() != 0)
{
// Finish reading the request body in case the app did not.
}
// Finish reading the request body in case the app did not.
await MessageBody.Consume();
}
terminated = !_keepAlive;

View File

@ -38,20 +38,22 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
return result;
}
public Task<int> SkipAsync(CancellationToken cancellationToken = default(CancellationToken))
public async Task Consume(CancellationToken cancellationToken = default(CancellationToken))
{
Task<int> result = null;
var send100Continue = 0;
result = SkipAsyncImplementation(cancellationToken);
if (!result.IsCompleted)
Task<int> result;
do
{
send100Continue = Interlocked.Exchange(ref _send100Continue, 0);
}
if (send100Continue == 1)
{
_context.FrameControl.ProduceContinue();
}
return result;
var send100Continue = 0;
result = SkipAsyncImplementation(cancellationToken);
if (!result.IsCompleted)
{
send100Continue = Interlocked.Exchange(ref _send100Continue, 0);
}
if (send100Continue == 1)
{
_context.FrameControl.ProduceContinue();
}
} while (await result != 0);
}
public abstract Task<int> ReadAsyncImplementation(ArraySegment<byte> buffer, CancellationToken cancellationToken);