/* * public void CleanupOutdatedSession() * { * if (!MSManager.Instance.AuthentificatedClients.Any(s => s.Equals(CurrentClient.ClientId))) * { * return; * } * * AccountConnection[] tmp = new AccountConnection[MSManager.Instance.ConnectedAccounts.Count + 20]; * lock (MSManager.Instance.ConnectedAccounts) * { * MSManager.Instance.ConnectedAccounts.CopyTo(tmp); * } * foreach (AccountConnection account in tmp.Where(a => a != null && a?.LastPulse.AddMinutes(5) <= DateTime.Now)) * { * KickSession(account.AccountId, null); * } * } */ public void CleanupOutdatedSession() { AccountConnection[] tmp = new AccountConnection[MSManager.Instance.ConnectedAccounts.Count + 20]; lock (MSManager.Instance.ConnectedAccounts) { MSManager.Instance.ConnectedAccounts.CopyTo(tmp); } foreach (AccountConnection account in tmp.Where(a => a?.LastPulse.AddMinutes(5) <= DateTime.Now)) { KickSession(account.AccountId, null); } }
public void CleanupOutdatedSession() { if (!MSManager.Instance.AuthentificatedClients.Any(s => s.Equals(CurrentClient.ClientId))) { return; } AccountConnection[] tmp = new AccountConnection[MSManager.Instance.ConnectedAccounts.Count + 20]; lock (MSManager.Instance.ConnectedAccounts) { MSManager.Instance.ConnectedAccounts.CopyTo(tmp); } foreach (AccountConnection account in tmp.Where(a => a != null && a?.LastPulse.AddMinutes(5) <= DateTime.Now)) { KickSession(account.AccountId, null); } }