/// <param name="remotePeerId">null for 'pending' peers</param> internal ConnectedPeer(LocalPeer localPeer, PeerId remotePeerId, ConnectedPeerType type, IPAddress remoteIp) { RemoteIp = remoteIp.ToString(); Type = type; RemotePeerId = remotePeerId; _localPeer = localPeer; Extensions = localPeer.Configuration.Extensions.ToDictionary(ext => ext, ext => ext.OnConnectedPeer(this)); }
void AddToPendingPeers(ConnectedPeerType type, IPEndPoint remoteEndpoint, SocketWithReceiver socket) { var cp = new ConnectedPeer(_localPeer, null, type, remoteEndpoint.Address); cp.TryAddStream(socket, remoteEndpoint, null, _pendingPeers.Values.Select(x => x.Streams.Values.Single().StreamId)); // all "pending" streams will have unique local stream ID _pendingPeers.Add(remoteEndpoint, cp); }