[Fix] Move it out

Fix for issue #235
This commit is contained in:
sta 2016-03-29 17:10:11 +09:00
parent c10e5a7049
commit 8fd4b160f8

View File

@ -415,18 +415,20 @@ namespace WebSocketSharp.Net
private void cleanupConnections () private void cleanupConnections ()
{ {
HttpConnection[] conns = null;
lock (_connectionsSync) { lock (_connectionsSync) {
if (_connections.Count == 0) if (_connections.Count == 0)
return; return;
// Need to copy this since closing will call the RemoveConnection method. // Need to copy this since closing will call the RemoveConnection method.
var keys = _connections.Keys; var keys = _connections.Keys;
var conns = new HttpConnection[keys.Count]; conns = new HttpConnection[keys.Count];
keys.CopyTo (conns, 0); keys.CopyTo (conns, 0);
_connections.Clear (); _connections.Clear ();
for (var i = conns.Length - 1; i >= 0; i--)
conns[i].Close (true);
} }
for (var i = conns.Length - 1; i >= 0; i--)
conns[i].Close (true);
} }
private void cleanupContextRegistry () private void cleanupContextRegistry ()