private void CloseMatches(string Reason) { if (Matches == null) { return; } foreach (Connection Match in Matches.ToList <Connection>()) { if (Match.Matches.Count > 0) { Match.Matches.Remove(GUID); } if (Match.Matches.Count == 0) { Match.Close(Reason); } } Matches.Clear(); }
public void Close(string Reason) { if (isClosed) { return; } isClosed = true; foreach (Connection Ctx in Clients) // Client first { Remove(Ctx, "Server is closing: " + Reason, false); } Keys.Clear(); Clients.Clear(); Keys = null; Clients = null; iServer.Close(Reason); }