/// <summary> /// Stop listening to the new requests or suspend the answering process /// </summary> public void Stop() { this.Status = ControllerStatuses.Stopped; if (this.acceptingWorker.IsBusy) { // If we are working this.acceptingWorker.CancelAsync(); this.routingWorker.CancelAsync(); } PeaRoxyClient[] cls; lock (this.connectedClients) { cls = new PeaRoxyClient[this.connectedClients.Count]; this.connectedClients.CopyTo(cls); this.connectedClients.Clear(); } foreach (PeaRoxyClient client in cls) { client.Close(); } lock (this.routingClients) this.routingClients.Clear(); }
internal void ClientDisconnected(PeaRoxyClient client) { lock (this.routingClients) if (this.routingClients.Contains(client)) { this.routingClients.Remove(client); } lock (this.connectedClients) if (this.connectedClients.Contains(client)) { this.connectedClients.Remove(client); } }
internal void ClientMoveToRouting(PeaRoxyClient client) { lock (this.routingClients) this.routingClients.Add(client); }