Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions websocket-sharp/WebSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2576,6 +2576,27 @@ private void startReceiving()
},
ex =>
{
// releaseServerResources() disposes the stream while this read can still be
// pending, so once closing has begun a failed read is the expected outcome of
// our own teardown, not a fault: the peer is gone, the close handshake timed
// out waiting for its close frame, and we tore the transport down underneath
// the reader. Report receiving as finished and let the close path carry on -
// logging it as Fatal and aborting an already-closing connection only
// produced noise ("Cannot access a disposed object ... NetworkStream") for
// every socket of a client whose network dropped.
if (_readyState == WebSocketState.Closing
|| _readyState == WebSocketState.Closed)
{
_log.Trace(ex.Message);

var exited = _receivingExited;

if (exited != null)
exited.Set();

return;
}

_log.Fatal(ex.Message);
_log.Debug(ex.ToString());

Expand Down
Loading