Improved Send100 Check

This commit is contained in:
Ben Adams 2015-11-16 06:43:49 +00:00
parent ecc439555e
commit 7691a7cc23
1 changed files with 7 additions and 4 deletions

View File

@ -41,16 +41,19 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
public async Task Consume(CancellationToken cancellationToken = default(CancellationToken))
{
Task<int> result;
var firstLoop = true;
var send100checked = false;
do
{
result = ReadAsyncImplementation(default(ArraySegment<byte>), cancellationToken);
if (!result.IsCompleted)
{
if (firstLoop && Interlocked.Exchange(ref _send100Continue, 0) == 1)
if (!send100checked)
{
firstLoop = false;
_context.FrameControl.ProduceContinue();
if (Interlocked.Exchange(ref _send100Continue, 0) == 1)
{
_context.FrameControl.ProduceContinue();
}
send100checked = true;
}
}
else if (result.GetAwaiter().GetResult() == 0)