1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-27 01:57:52 +00:00

(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

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 );