Bloom.Api.ServerBase.QueueRequest C# (CSharp) Method

QueueRequest() private method

This method is called in the _listenerThread when we obtain an HTTP request from the _listener, and queues it for processing by a worker.
private QueueRequest ( IAsyncResult ar ) : void
ar IAsyncResult
return void
        private void QueueRequest(IAsyncResult ar)
        {
            // this can happen when shutting down
            // BL-2207 indicates it may be possible for the thread to be alive and the listener closed,
            // although the only way I know it gets closed happens after joining with that thread.
            // Still, one more check seems worthwhile...if we're far enough along in shutting down
            // to have closed the listener we certainly can't respond to any more requests.
            if (!_listenerThread.IsAlive || !_listener.IsListening)
                return;

            lock (_queue)
            {
                _queue.Enqueue(_listener.EndGetContext(ar));
                _ready.Set();
            }
        }