React to channel API changes

This commit is contained in:
David Fowler 2016-10-07 16:18:23 -07:00
parent eef2f14c78
commit 08bba972c1
5 changed files with 14 additions and 9 deletions

View File

@ -17,10 +17,11 @@ namespace SocketsSample
while (true)
{
var input = await connection.Channel.Input.ReadAsync();
var result = await connection.Channel.Input.ReadAsync();
var input = result.Buffer;
try
{
if (input.IsEmpty && connection.Channel.Input.Reading.IsCompleted)
if (input.IsEmpty && result.IsCompleted)
{
break;
}

View File

@ -58,7 +58,8 @@ namespace SocketsSample
}
catch (Exception)
{
if (connection.Channel.Input.Reading.IsCompleted)
var result = await connection.Channel.Input.ReadAsync();
if (result.IsCompleted)
{
break;
}

View File

@ -18,9 +18,10 @@ namespace Microsoft.AspNetCore.Sockets
public async Task ProcessRequest(HttpContext context)
{
var buffer = await _channel.Output.ReadAsync();
var result = await _channel.Output.ReadAsync();
var buffer = result.Buffer;
if (buffer.IsEmpty && _channel.Output.Reading.IsCompleted)
if (buffer.IsEmpty && result.IsCompleted)
{
// Client should stop if it receives a 204
context.Response.StatusCode = 204;

View File

@ -24,9 +24,10 @@ namespace Microsoft.AspNetCore.Sockets
while (true)
{
var buffer = await _channel.Output.ReadAsync();
var result = await _channel.Output.ReadAsync();
var buffer = result.Buffer;
if (buffer.IsEmpty && _channel.Output.Reading.IsCompleted)
if (buffer.IsEmpty && result.IsCompleted)
{
break;
}

View File

@ -73,11 +73,12 @@ namespace Microsoft.AspNetCore.Sockets
{
while (true)
{
var buffer = await _channel.Output.ReadAsync();
var result = await _channel.Output.ReadAsync();
var buffer = result.Buffer;
try
{
if (buffer.IsEmpty && _channel.Output.Reading.IsCompleted)
if (buffer.IsEmpty && result.IsCompleted)
{
break;
}