Skip to content

Commit

Permalink
Check for null message reader
Browse files Browse the repository at this point in the history
When disconnecting, the await will return a null reader. This need to be
checked.
  • Loading branch information
vtortola committed Oct 17, 2014
1 parent 0205272 commit 7ee12c8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions samples/EchoServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ static async Task HandleConnectionAsync(WebSocket ws, CancellationToken cancella
while (ws.IsConnected && !cancellation.IsCancellationRequested)
{
String msg = await ws.ReadStringAsync(cancellation).ConfigureAwait(false);
if (msg == null)
continue;

PerformanceCounters.MessagesIn.Increment();

ws.WriteString(msg);
Expand Down

0 comments on commit 7ee12c8

Please sign in to comment.