Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence premature web socket disconnections. #3654

Merged
merged 2 commits into from
Dec 1, 2021
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
18 changes: 16 additions & 2 deletions src/Nethermind/Nethermind.Sockets/WebSocketHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,24 @@ await resultTask.ContinueWith(t =>
{
if (socketException.SocketErrorCode == SocketError.ConnectionReset)
{
if (_logger.IsDebug) _logger.Debug($"Client disconnected: {innerException.Message}.");
else _logger.Info($"Not able to read from WebSockets ({socketException.SocketErrorCode}: {socketException.ErrorCode}). {innerException.Message}");
if (_logger.IsTrace) _logger.Trace($"Client disconnected: {innerException.Message}.");
}
else
{
if (_logger.IsInfo) _logger.Info($"Not able to read from WebSockets ({socketException.SocketErrorCode}: {socketException.ErrorCode}). {innerException.Message}");
}
}
else if(innerException is WebSocketException webSocketException)
{
if (webSocketException.WebSocketErrorCode == WebSocketError.ConnectionClosedPrematurely)
{
if (_logger.IsTrace) _logger.Trace($"Client disconnected: {innerException.Message}.");
}
else
{
if (_logger.IsInfo) _logger.Info($"Not able to read from WebSockets ({webSocketException.WebSocketErrorCode}: {webSocketException.ErrorCode}). {innerException.Message}");
}
}
else
{
if (_logger.IsInfo) _logger.Info($"Not able to read from WebSockets. {innerException?.Message}");
Expand Down