internal HttpResponseMessage GetNextResponse() { return(ResponseQueue.Any() ? ResponseQueue.Dequeue() : new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("") }); }
private RestResponse HandleInSequence() { if (ResponseQueue.Count == 0) { throw new ArgumentOutOfRangeException("No responses queued"); } var nextQueuedResponse = ResponseQueue.Dequeue(); return(CreateResponse(nextQueuedResponse)); }
private void SendResponseToClient() { while (true) { var response = responseQueue.Dequeue(); if (response != null) { // Console.WriteLine("Found Response. Sending.."); // Console.WriteLine("Client is active --> " + response.client.Poll(100,SelectMode.SelectWrite)); // Console.WriteLine("reply -->" + response.reply); Send(response.client, response.reply); } else { Thread.Sleep(1); } } }