fix uncatchable exception
This commit is contained in:
parent
fd41af4480
commit
11863701cf
1 changed files with 10 additions and 1 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue