Provides the data needed to handle a PieceHashed event
Inheritance: TorrentEventArgs
Beispiel #1
0
        internal void RaisePieceHashed(PieceHashedEventArgs args)
        {
            int index = args.PieceIndex;

            TorrentFile[] files = this._torrent.Files;

            for (int i = 0; i < files.Length; i++)
            {
                if (index >= files[i].StartPieceIndex && index <= files[i].EndPieceIndex)
                {
                    files[i].BitField[index - files[i].StartPieceIndex] = args.HashPassed;
                }
            }

            if (args.HashPassed)
            {
                List <PeerId> connected = Peers.ConnectedPeers;
                for (int i = 0; i < connected.Count; i++)
                {
                    connected[i].IsAllowedFastPieces.Remove(index);
                }
            }

            Toolbox.RaiseAsyncEvent <PieceHashedEventArgs>(PieceHashed, this, args);
        }
Beispiel #2
0
 private void PieceHashed(object sender, PieceHashedEventArgs e)
 {
     if (e.TorrentManager.State != TorrentState.Hashing)
     {
         diskManager.QueueFlush(e.TorrentManager, e.PieceIndex);
     }
 }
Beispiel #3
0
        internal void HashedPiece(PieceHashedEventArgs pieceHashedEventArgs)
        {
            if (!pieceHashedEventArgs.HashPassed)
            {
                Interlocked.Increment(ref this._hashFails);
            }

            RaisePieceHashed(pieceHashedEventArgs);
        }
Beispiel #4
0
 private void PieceHashed(object sender, PieceHashedEventArgs e)
 {
     if (e.TorrentManager.State != TorrentState.Hashing)
         diskManager.QueueFlush(e.TorrentManager, e.PieceIndex);
 }