[Modify] Polish it

This commit is contained in:
sta 2020-12-26 22:25:05 +09:00
parent f5d9dffc95
commit 1a2a4d7845

View File

@ -936,13 +936,16 @@ namespace WebSocketSharp.Server
{ {
while (true) { while (true) {
HttpListenerContext ctx = null; HttpListenerContext ctx = null;
try { try {
ctx = _listener.GetContext (); ctx = _listener.GetContext ();
ThreadPool.QueueUserWorkItem ( ThreadPool.QueueUserWorkItem (
state => { state => {
try { try {
if (ctx.Request.IsUpgradeRequest ("websocket")) { if (ctx.Request.IsUpgradeRequest ("websocket")) {
processRequest (ctx.AcceptWebSocket (null)); processRequest (ctx.AcceptWebSocket (null));
return; return;
} }
@ -959,10 +962,12 @@ namespace WebSocketSharp.Server
} }
catch (HttpListenerException) { catch (HttpListenerException) {
_log.Info ("The underlying listener is stopped."); _log.Info ("The underlying listener is stopped.");
break; break;
} }
catch (InvalidOperationException) { catch (InvalidOperationException) {
_log.Info ("The underlying listener is stopped."); _log.Info ("The underlying listener is stopped.");
break; break;
} }
catch (Exception ex) { catch (Exception ex) {