Esempio n. 1
0
        private void UpdateRequestWithNextPiece()
        {
            // else get a new piece to find
            int pieceId = DownloadStrategyHelp.DecideNextPiece(mManager, null);

            if (pieceId >= 0)
            {
                int pieceSectionLength = DownloadStrategyHelp.CalculatePieceSectionLength(mManager, pieceId, 0);
                this.mEndGameRequest = new PieceRequest(null, pieceId, 0, pieceSectionLength);
            }
        }
Esempio n. 2
0
 private void StartDownloadingNextPieceIfPossible(Peer peer)
 {
     // if the peer isn't choking, isn't currently downloading anything and the maximum number of downloads hasn't been reached
     // we can authorise a request to be sent
     if (!peer.HeIsChoking && peer.AmIInterested && !this.mManager.IsPeerDownloading(peer))                // && this.piecesDownloading.Count < Config.ActiveConfig.SimultaneousDownloadsLimit)
     {
         int pieceId = DownloadStrategyHelp.DecideNextPiece(mManager, peer);
         if (pieceId >= 0)
         {
             mManager.SendPieceRequestToPeer(peer, pieceId, 0, DownloadStrategyHelp.CalculatePieceSectionLength(mManager, pieceId, 0));
         }
     }
 }