|
|
|
|
@ -560,7 +560,11 @@ namespace WebSocketSharp.Net
|
|
|
|
|
if (!_listening)
|
|
|
|
|
throw new InvalidOperationException ("The listener hasn't been started.");
|
|
|
|
|
|
|
|
|
|
// Lock _waitQueue early to avoid race conditions.
|
|
|
|
|
// Lock _ctxRegistrySync early to avoid race conditions.
|
|
|
|
|
lock (_ctxRegistrySync) {
|
|
|
|
|
if (!_listening)
|
|
|
|
|
throw new InvalidOperationException ("The listener is stopped/closed.");
|
|
|
|
|
|
|
|
|
|
lock (_waitQueueSync) {
|
|
|
|
|
var ctx = getContextFromQueue ();
|
|
|
|
|
if (ctx != null) {
|
|
|
|
|
@ -570,6 +574,7 @@ namespace WebSocketSharp.Net
|
|
|
|
|
|
|
|
|
|
_waitQueue.Add (asyncResult);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return asyncResult;
|
|
|
|
|
}
|
|
|
|
|
|