FlushQueue() public method

public FlushQueue ( ) : void
return void
Example #1
0
        public void HandleMessages(Message[] messages, CometAsyncResult asyncResult)
        {
            // Do this before we process the messages in case it's a disconnect
            Client sendingClient = GetSenderOf(messages);

            IMessagesProcessor processor = this.CreateProcessorAndProcess(messages);

            if (sendingClient == null)
            {
                asyncResult.CompleteRequestWithMessages(processor.Result);
                return;
            }

            if (sendingClient.CurrentAsyncResult != null)
            {
                sendingClient.FlushQueue();
            }

            sendingClient.CurrentAsyncResult = asyncResult;
            sendingClient.Enqueue(processor.Result);

            if (processor.ShouldSendResultStraightBackToClient)
            {
                sendingClient.FlushQueue();
            }
        }