public override Task OnReconnected() { var client = ClientConnected.Factory(Context); if (!_connections.Contains(client)) { if (!client.IsClientDotNet()) { var lstSame = _connections.Same(client); lstSame.ForEach(p => _connections.Remove(p)); _connections.Add(client); OnConnectionsChanged(); } else { _connectionControl = client; } } return(base.OnReconnected()); }
public bool IsSame(ClientConnected other) { return(this.Ip == other.Ip && this.Referer == other.Referer && this.UserAgent == other.UserAgent); }
protected bool Equals(ClientConnected other) { return(string.Equals(Id, other.Id)); }
public static List <ClientConnected> Same(this IEnumerable <ClientConnected> list, ClientConnected clientConnected) { //var returnList = new List<ClientConnected>(); //foreach (var connected in list.ToList()) //{ // if(connected.IsSame(clientConnected)) // returnList.Add(connected); // else // { // Debug.WriteLine(clientConnected + "\n" + connected); // } //} //return returnList; return(list.Where(p => p.IsSame(clientConnected)).ToList()); }