예제 #1
0
        public void Choke(PeerId peer)
        {
            //Choke the supplied peer

            if (peer.AmChoking)
            {
                //We're already choking this peer, nothing to do
                return;
            }

            peer.AmChoking = true;
            _owningTorrent.UploadingTo--;
            RejectPendingRequests(peer);
            peer.EnqueueAt(new ChokeMessage(), 0);
            Debug.WriteLine(peer.Connection, "Choking");
            //			Send2Log("Choking: " + PeerToChoke.Location);
        }
예제 #2
0
        public void Unchoke(PeerId peerToUnchoke)
        {
            //Unchoke the supplied peer

            if (!peerToUnchoke.AmChoking)
            {
                //We're already unchoking this peer, nothing to do
                return;
            }

            peerToUnchoke.AmChoking = false;
            _owningTorrent.UploadingTo++;
            peerToUnchoke.EnqueueAt(new UnchokeMessage(), 0);
            peerToUnchoke.LastUnchoked      = DateTime.Now;
            peerToUnchoke.FirstReviewPeriod = true;
            Debug.WriteLine(peerToUnchoke.Connection, "Unchoking");
            //			Send2Log("Unchoking: " + PeerToUnchoke.Location);
        }