(trunk libT) #3767 "rarest first policy" -- possible fix for assertion error reported by rolcol

Resolve the problem described @ https://trac.transmissionbt.com/ticket/3767#comment:38
This commit is contained in:
Jordan Lee 2011-02-17 12:57:36 +00:00
parent 4e60838434
commit 77bdb6522d
1 changed files with 6 additions and 8 deletions

View File

@ -1206,10 +1206,9 @@ tr_incrReplicationFromBitfield( Torrent * t, const tr_bitfield * b )
assert( n == t->pieceReplicationSize );
assert( tr_bitfieldTestFast( b, n-1 ) );
if( tr_bitfieldTestFast( b, n-1 ) )
for( i=0; i<n; ++i )
if( tr_bitfieldHasFast( b, i ) )
++rep[i];
for( i=0; i<n; ++i )
if( tr_bitfieldHas( b, i ) )
++rep[i];
if( t->pieceSortState == PIECES_SORTED_BY_WEIGHT )
invalidatePieceSorting( t );
@ -1252,10 +1251,9 @@ tr_decrReplicationFromBitset( Torrent * t, const tr_bitset * bitset )
{
const tr_bitfield * const b = &bitset->bitfield;
if( tr_bitfieldTestFast( b, n-1 ) )
for( i=0; i<n; ++i )
if( tr_bitfieldHasFast( b, i ) )
--t->pieceReplication[i];
for( i=0; i<n; ++i )
if( tr_bitfieldHas( b, i ) )
--t->pieceReplication[i];
if( t->pieceSortState == PIECES_SORTED_BY_WEIGHT )
invalidatePieceSorting( t );