|
|
|
|
@ -469,9 +469,9 @@ namespace WebSocketSharp.Net
|
|
|
|
|
cleanup (force);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Must be called with a lock on _ctxQueue.
|
|
|
|
|
private HttpListenerContext getContextFromQueue ()
|
|
|
|
|
{
|
|
|
|
|
lock (_ctxQueueSync) {
|
|
|
|
|
if (_ctxQueue.Count == 0)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
@ -480,6 +480,7 @@ namespace WebSocketSharp.Net
|
|
|
|
|
|
|
|
|
|
return ctx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void sendServiceUnavailable ()
|
|
|
|
|
{
|
|
|
|
|
@ -561,13 +562,11 @@ namespace WebSocketSharp.Net
|
|
|
|
|
|
|
|
|
|
// Lock _waitQueue early to avoid race conditions.
|
|
|
|
|
lock (_waitQueueSync) {
|
|
|
|
|
lock (_ctxQueueSync) {
|
|
|
|
|
var ctx = getContextFromQueue ();
|
|
|
|
|
if (ctx != null) {
|
|
|
|
|
asyncResult.Complete (ctx, true);
|
|
|
|
|
return asyncResult;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_waitQueue.Add (asyncResult);
|
|
|
|
|
}
|
|
|
|
|
|