Consume in single call
This commit is contained in:
parent
f48e6ba51a
commit
f089abd337
|
|
@ -232,10 +232,8 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
|
|
||||||
await ProduceEnd();
|
await ProduceEnd();
|
||||||
|
|
||||||
while (await MessageBody.SkipAsync() != 0)
|
// Finish reading the request body in case the app did not.
|
||||||
{
|
await MessageBody.Consume();
|
||||||
// Finish reading the request body in case the app did not.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
terminated = !_keepAlive;
|
terminated = !_keepAlive;
|
||||||
|
|
|
||||||
|
|
@ -38,20 +38,22 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<int> SkipAsync(CancellationToken cancellationToken = default(CancellationToken))
|
public async Task Consume(CancellationToken cancellationToken = default(CancellationToken))
|
||||||
{
|
{
|
||||||
Task<int> result = null;
|
Task<int> result;
|
||||||
var send100Continue = 0;
|
do
|
||||||
result = SkipAsyncImplementation(cancellationToken);
|
|
||||||
if (!result.IsCompleted)
|
|
||||||
{
|
{
|
||||||
send100Continue = Interlocked.Exchange(ref _send100Continue, 0);
|
var send100Continue = 0;
|
||||||
}
|
result = SkipAsyncImplementation(cancellationToken);
|
||||||
if (send100Continue == 1)
|
if (!result.IsCompleted)
|
||||||
{
|
{
|
||||||
_context.FrameControl.ProduceContinue();
|
send100Continue = Interlocked.Exchange(ref _send100Continue, 0);
|
||||||
}
|
}
|
||||||
return result;
|
if (send100Continue == 1)
|
||||||
|
{
|
||||||
|
_context.FrameControl.ProduceContinue();
|
||||||
|
}
|
||||||
|
} while (await result != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Task<int> ReadAsyncImplementation(ArraySegment<byte> buffer, CancellationToken cancellationToken);
|
public abstract Task<int> ReadAsyncImplementation(ArraySegment<byte> buffer, CancellationToken cancellationToken);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue