From 1a2a4d78457f3355842a026a91e5b51c7633499a Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 26 Dec 2020 22:25:05 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Server/HttpServer.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/websocket-sharp/Server/HttpServer.cs b/websocket-sharp/Server/HttpServer.cs index 56925ac6..b00382bb 100644 --- a/websocket-sharp/Server/HttpServer.cs +++ b/websocket-sharp/Server/HttpServer.cs @@ -936,13 +936,16 @@ namespace WebSocketSharp.Server { while (true) { HttpListenerContext ctx = null; + try { ctx = _listener.GetContext (); + ThreadPool.QueueUserWorkItem ( state => { try { if (ctx.Request.IsUpgradeRequest ("websocket")) { processRequest (ctx.AcceptWebSocket (null)); + return; } @@ -959,10 +962,12 @@ namespace WebSocketSharp.Server } catch (HttpListenerException) { _log.Info ("The underlying listener is stopped."); + break; } catch (InvalidOperationException) { _log.Info ("The underlying listener is stopped."); + break; } catch (Exception ex) {