Remove uses of ValueTask<T>'s implicit casts

These are being removed.
This commit is contained in:
Stephen Toub 2016-05-27 10:28:24 -04:00
parent 8df6fbc500
commit 69d8b17095
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); var limit = buffer.Array == null ? inputLengthLimit : Math.Min(buffer.Count, inputLengthLimit);
if (limit == 0) if (limit == 0)
{ {
return 0; return new ValueTask<int>(0);
} }
var task = _context.SocketInput.ReadAsync(buffer.Array, buffer.Offset, limit); 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"); _context.RejectRequest("Unexpected end of request content");
} }
return actual; return new ValueTask<int>(actual);
} }
else 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) 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) 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) if (actual != 0)
{ {
return actual; return new ValueTask<int>(actual);
} }
else if (fin) 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) private static async Task<int> ReadAsyncAwaited(this SocketInput input, byte[] buffer, int offset, int count)