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