fix uncatchable exception

This commit is contained in:
Elijah R 2023-11-06 21:07:08 -05:00
parent fd41af4480
commit 11863701cf

View file

@ -173,7 +173,16 @@ public class CollabVMClient {
MemoryStream ms = new(); MemoryStream ms = new();
WebSocketReceiveResult res; WebSocketReceiveResult res;
do { do {
res = await socket.ReceiveAsync(receivebuffer, CancellationToken.None); try {
res = await socket.ReceiveAsync(receivebuffer, CancellationToken.None);
} catch (WebSocketException e) {
#if DEBUG
Console.Error.WriteLine($"Got {e.Message} while reading from WebSocket, closing connection");
#endif
Cleanup(true);
return;
}
if (res.MessageType == WebSocketMessageType.Close) { if (res.MessageType == WebSocketMessageType.Close) {
this.Disconnect(); this.Disconnect();
return; return;