[Fix] Replace it

This commit is contained in:
sta 2016-04-15 15:49:47 +09:00
parent 25f5cfb204
commit 7e80355694

View File

@ -596,29 +596,24 @@ namespace WebSocketSharp.Net
if (!_listening) if (!_listening)
return false; return false;
HttpListenerAsyncResult ares = null;
lock (_ctxRegistrySync) { lock (_ctxRegistrySync) {
if (!_listening) if (!_listening)
return false; return false;
_ctxRegistry[context] = context; _ctxRegistry[context] = context;
lock (_waitQueueSync) {
if (_waitQueue.Count == 0) { var ares = getAsyncResultFromQueue ();
if (ares == null) {
lock (_ctxQueueSync) lock (_ctxQueueSync)
_ctxQueue.Add (context); _ctxQueue.Add (context);
} }
else { else {
ares = _waitQueue[0];
_waitQueue.RemoveAt (0);
}
}
}
if (ares != null)
ares.Complete (context); ares.Complete (context);
}
return true; return true;
} }
}
internal void RemoveConnection (HttpConnection connection) internal void RemoveConnection (HttpConnection connection)
{ {