[Modify] Polish it

This commit is contained in:
sta 2021-04-06 19:39:50 +09:00
parent ce577ff0f7
commit ee3cadf19c

View File

@ -457,6 +457,7 @@ namespace WebSocketSharp.Net
private void cleanupContextRegistry () private void cleanupContextRegistry ()
{ {
HttpListenerContext[] ctxs = null; HttpListenerContext[] ctxs = null;
lock (_ctxRegistrySync) { lock (_ctxRegistrySync) {
if (_ctxRegistry.Count == 0) if (_ctxRegistry.Count == 0)
return; return;
@ -465,6 +466,7 @@ namespace WebSocketSharp.Net
var keys = _ctxRegistry.Keys; var keys = _ctxRegistry.Keys;
ctxs = new HttpListenerContext[keys.Count]; ctxs = new HttpListenerContext[keys.Count];
keys.CopyTo (ctxs, 0); keys.CopyTo (ctxs, 0);
_ctxRegistry.Clear (); _ctxRegistry.Clear ();
} }