Skip to content

Commit

Permalink
客户端WebSocket接收大循环中,应该捕获所有异常
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Oct 30, 2024
1 parent e8f6c98 commit 63a8d28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions NewLife.Remoting/Clients/WsChannelCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private async Task DoPull(WebSocket socket, CancellationTokenSource source)
if (data.MessageType == WebSocketMessageType.Text)
{
var txt = buf.ToStr(null, 0, data.Count);
await OnReceive(txt);
if (txt != null) await OnReceive(txt);
}
}

Expand All @@ -100,7 +100,7 @@ private async Task DoPull(WebSocket socket, CancellationTokenSource source)
}
catch (TaskCanceledException) { }
catch (OperationCanceledException) { }
catch (WebSocketException ex)
catch (Exception ex)
{
_client.Log?.Error("WebSocket异常 {0}", ex.Message);
}
Expand Down

0 comments on commit 63a8d28

Please sign in to comment.