From eeed531377d0fac6ef285f8842fe51f4c1642af4 Mon Sep 17 00:00:00 2001 From: Harald Wolff Date: Mon, 2 Sep 2019 12:17:50 +0200 Subject: [PATCH] Fix ApplicationWebSocket behaviour on IOException --- ApplicationWebSocket.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ApplicationWebSocket.cs b/ApplicationWebSocket.cs index 6da10a0..1ede16d 100644 --- a/ApplicationWebSocket.cs +++ b/ApplicationWebSocket.cs @@ -7,6 +7,7 @@ using ln.json; using ln.logging; using ln.types.rpc; using System.Linq; +using System.IO; namespace ln.application { public class ApplicationWebSocket : WebsocketResource @@ -48,6 +49,7 @@ namespace ln.application currentWebSockets.Add(webSocket); break; case WSREvent.CLOSE: + case WSREvent.ERROR: currentWebSockets.Remove(webSocket); break; } @@ -63,8 +65,13 @@ namespace ln.application { foreach (WebSocket webSocket in CurrentWebSockets) { - webSocket.Send(text); - } + try + { + webSocket.Send(text); + } + catch (IOException) + { } + } } public override void MessageReceived(WebSocketResourceRequestContext requestContext, string textMessage)