Merge branch 'stephentoub/remove_valuetask_casts' into dev

This commit is contained in:
Stephen Halter 2016-05-27 15:47:13 -07:00
commit 1a6ec294bc
2 changed files with 7 additions and 7 deletions

View File

@ -175,7 +175,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
var limit = buffer.Array == null ? inputLengthLimit : Math.Min(buffer.Count, inputLengthLimit);
if (limit == 0)
{
return 0;
return new ValueTask<int>(0);
}
var task = _context.SocketInput.ReadAsync(buffer.Array, buffer.Offset, limit);
@ -189,11 +189,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
{
_context.RejectRequest("Unexpected end of request content");
}
return actual;
return new ValueTask<int>(actual);
}
else
{
return ReadAsyncAwaited(task.AsTask());
return new ValueTask<int>(ReadAsyncAwaited(task.AsTask()));
}
}
@ -232,7 +232,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
public override ValueTask<int> ReadAsyncImplementation(ArraySegment<byte> buffer, CancellationToken cancellationToken)
{
return ReadStateMachineAsync(_context.SocketInput, buffer, cancellationToken);
return new ValueTask<int>(ReadStateMachineAsync(_context.SocketInput, buffer, cancellationToken));
}
private async Task<int> ReadStateMachineAsync(SocketInput input, ArraySegment<byte> buffer, CancellationToken cancellationToken)

View File

@ -21,15 +21,15 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
if (actual != 0)
{
return actual;
return new ValueTask<int>(actual);
}
else if (fin)
{
return 0;
return new ValueTask<int>(0);
}
}
return input.ReadAsyncAwaited(buffer, offset, count);
return new ValueTask<int>(input.ReadAsyncAwaited(buffer, offset, count));
}
private static async Task<int> ReadAsyncAwaited(this SocketInput input, byte[] buffer, int offset, int count)