/// <summary> /// Creates a input and output data handlers and starts handling data from server. /// </summary> /// <param name="connection">Opened server connection.</param> public void StartHandling(ServerConnection connection) { if (connection.IsClosed) { Console.WriteLine("Debug message: Handling data was started with a closed server connection"); } RequestQueue outputQueue = RequestRepository.Instance.OutputRequests; RequestQueue inputQueue = RequestRepository.Instance.InputRequests; IQueueHandler outputHandler = new OutputHandler(outputQueue, connection); IQueueHandler inputHandler = new InputHandler(inputQueue); outputQueue.Clear(); inputQueue.Clear(); RequestRepository.Instance.OutputHandler = outputHandler; RequestRepository.Instance.InputHandler = inputHandler; outputHandler.StartHandling(); inputHandler.StartHandling(); }
public void ClearQueue() { RequestQueue.Clear(); }