Example #1
0
        internal void ConnectToPeer(TorrentManager manager, Peer peer)
        {
            // Connect to the peer.
            var connection = ConnectionFactory.Create(peer.ConnectionUri);

            if (connection == null)
            {
                return;
            }

            peer.LastConnectionAttempt = DateTime.Now;
            var c = new AsyncConnectState(manager, peer, connection);

            _pendingConnects.Add(c);

            manager.Peers.ConnectingToPeers.Add(peer);
            NetworkIO.EnqueueConnect(connection, _endCreateConnectionCallback, c);
        }