/// <summary> /// Get copy of current connected peers /// </summary> /// <returns>Array with connected peers</returns> public NetPeer[] GetPeers() { NetPeer[] peers; lock (_peers) { peers = _peers.ToArray(); } return(peers); }
/// <summary> /// Get copy of current connected peers (slow! use GetPeersNonAlloc for best performance) /// </summary> /// <returns>Array with connected peers</returns> public NetPeer[] GetPeers(ConnectionState peerState) { if (peerState == ConnectionState.Any) { return(_peers.ToArray()); } List <NetPeer> peersList = new List <NetPeer>(); GetPeersNonAlloc(peersList, peerState); return(peersList.ToArray()); }