[Modify] Lock it

This commit is contained in:
sta 2021-04-20 19:41:23 +09:00
parent 3447e69286
commit 9bf82164e0

View File

@ -800,17 +800,20 @@ namespace WebSocketSharp.Net
if (!_listening)
return;
_listening = false;
lock (_contextRegistrySync) {
if (!_listening)
return;
EndPointManager.RemoveListener (this);
EndPointManager.RemoveListener (this);
lock (_contextRegistrySync)
cleanupContextQueue (true);
cleanupContextRegistry ();
cleanupContextRegistry ();
var ex = new HttpListenerException (995, "The listener is stopped.");
cleanupWaitQueue (ex);
var ex = new HttpListenerException (995, "The listener is stopped.");
cleanupWaitQueue (ex);
_listening = false;
}
}
#endregion