WebSocketSharp.Net.HttpListener.CleanupContextRegistry C# (CSharp) Method

CleanupContextRegistry() private method

private CleanupContextRegistry ( ) : void
return void
        void CleanupContextRegistry()
        {
            lock (((ICollection)registry).SyncRoot) {
                if (registry.Count == 0)
                    return;

                // Need to copy this since closing will call UnregisterContext
                ICollection keys = registry.Keys;
                var all = new HttpListenerContext [keys.Count];
                keys.CopyTo (all, 0);
                registry.Clear ();
                for (int i = all.Length - 1; i >= 0; i--)
                    all [i].Connection.Close (true);
            }
        }