Provides the data needed to handle a PieceHashed event
Inheritance: TorrentEventArgs
Exemplo n.º 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);
        }
Exemplo n.º 2
0
 private void PieceHashed(object sender, PieceHashedEventArgs e)
 {
     if (e.TorrentManager.State != TorrentState.Hashing)
     {
         diskManager.QueueFlush(e.TorrentManager, e.PieceIndex);
     }
 }
Exemplo n.º 3
0
        internal void HashedPiece(PieceHashedEventArgs pieceHashedEventArgs)
        {
            if (!pieceHashedEventArgs.HashPassed)
            {
                Interlocked.Increment(ref this._hashFails);
            }

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