From caa23026082ae9fd32f7b917f09316a212c045fe Mon Sep 17 00:00:00 2001 From: sta Date: Fri, 26 Mar 2021 19:38:58 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Net/HttpListener.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/websocket-sharp/Net/HttpListener.cs b/websocket-sharp/Net/HttpListener.cs index 07970e14..b8dad716 100644 --- a/websocket-sharp/Net/HttpListener.cs +++ b/websocket-sharp/Net/HttpListener.cs @@ -802,10 +802,12 @@ namespace WebSocketSharp.Net public void Stop () { CheckDisposed (); + if (!_listening) return; _listening = false; + EndPointManager.RemoveListener (this); lock (_ctxRegistrySync) @@ -813,7 +815,9 @@ namespace WebSocketSharp.Net cleanupContextRegistry (); cleanupConnections (); - cleanupWaitQueue (new HttpListenerException (995, "The listener is stopped.")); + + var ex = new HttpListenerException (995, "The listener is stopped."); + cleanupWaitQueue (ex); } #endregion