From dc9603071617402713fc152d3fe71d8c30ecc652 Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 26 Aug 2017 17:42:32 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/WebSocket.cs | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index d79ce65c..ca549e62 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -2213,7 +2213,7 @@ namespace WebSocketSharp } } - // As server, used to broadcast + // As server internal void Send ( Opcode opcode, byte[] data, Dictionary cache ) @@ -2225,27 +2225,21 @@ namespace WebSocketSharp return; } - try { - byte[] found; - if (!cache.TryGetValue (_compression, out found)) { - found = - new WebSocketFrame ( - Fin.Final, - opcode, - data.Compress (_compression), - _compression != CompressionMethod.None, - false - ) - .ToArray (); - - cache.Add (_compression, found); - } + byte[] found; + if (!cache.TryGetValue (_compression, out found)) { + found = new WebSocketFrame ( + Fin.Final, + opcode, + data.Compress (_compression), + _compression != CompressionMethod.None, + false + ) + .ToArray (); - sendBytes (found); - } - catch (Exception ex) { - _logger.Error (ex.ToString ()); + cache.Add (_compression, found); } + + sendBytes (found); } } }