public void OnConnect(Channel channel) { PeerConnection peer = (PeerConnection)channel; if (!this.active_peers.Contains(peer)) { if (!peer.IsActive) { Interlocked.Increment(ref this.passive_peers_count); } else { Interlocked.Increment(ref this.active_peers_count); } this.active_peers.Add(peer); this.active_peers.OrderBy(p => p.PeerStatistics.AverageLatency); peer.OnConnect(); } }