[Fix] Move it out

As a preventive move. See: issue #235
This commit is contained in:
sta 2016-04-01 11:06:48 +09:00
parent d879d983ce
commit 20ad884dbe

View File

@ -433,19 +433,21 @@ namespace WebSocketSharp.Net
private void cleanupContextRegistry ()
{
HttpListenerContext[] ctxs = null;
lock (_ctxRegistrySync) {
if (_ctxRegistry.Count == 0)
return;
// Need to copy this since closing will call the UnregisterContext method.
var keys = _ctxRegistry.Keys;
var ctxs = new HttpListenerContext[keys.Count];
ctxs = new HttpListenerContext[keys.Count];
keys.CopyTo (ctxs, 0);
_ctxRegistry.Clear ();
}
for (var i = ctxs.Length - 1; i >= 0; i--)
ctxs[i].Connection.Close (true);
}
}
private void cleanupWaitQueue ()
{