diff --git a/websocket-sharp/Net/HttpListener.cs b/websocket-sharp/Net/HttpListener.cs index 6e9ff470..8814a817 100644 --- a/websocket-sharp/Net/HttpListener.cs +++ b/websocket-sharp/Net/HttpListener.cs @@ -834,7 +834,14 @@ namespace WebSocketSharp.Net return; _listening = false; - close (false); + + EndPointManager.RemoveListener (this); + lock (_ctxRegistrySync) + sendServiceUnavailable (); + + cleanupContextRegistry (); + cleanupConnections (); + cleanupWaitQueue (new HttpListenerException (995, "The listener is stopped.")); } #endregion