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) while (true)
{ {
var input = await connection.Channel.Input.ReadAsync(); var result = await connection.Channel.Input.ReadAsync();
var input = result.Buffer;
try try
{ {
if (input.IsEmpty && connection.Channel.Input.Reading.IsCompleted) if (input.IsEmpty && result.IsCompleted)
{ {
break; break;
} }

View File

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

View File

@ -18,9 +18,10 @@ namespace Microsoft.AspNetCore.Sockets
public async Task ProcessRequest(HttpContext context) 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 // Client should stop if it receives a 204
context.Response.StatusCode = 204; context.Response.StatusCode = 204;

View File

@ -24,9 +24,10 @@ namespace Microsoft.AspNetCore.Sockets
while (true) 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; break;
} }

View File

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