1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00

fix a bug in tr_stat's availability numbers, reported by BentMyWookie

This commit is contained in:
Charles Kerr 2007-11-11 16:33:04 +00:00
parent 5373a9d82d
commit 8516860fec
4 changed files with 6 additions and 5 deletions

View file

@ -1311,7 +1311,7 @@ tr_peerMgrGetAvailable( const tr_peerMgr * manager,
pieces = tr_bitfieldDup( tr_cpPieceBitfield( t->tor->completion ) );
for( i=0; i<size; ++i )
if( peers[i]->io != NULL )
tr_bitfieldAnd( pieces, peers[i]->have );
tr_bitfieldOr( pieces, peers[i]->have );
managerUnlock( (tr_peerMgr*)manager );
return pieces;

View file

@ -1764,4 +1764,5 @@ tr_peerMsgsIsPieceSuggested( const tr_peermsgs * peer,
uint32_t index )
{
return tr_bitfieldHas( peer->clientSuggestedPieces, index );
}
}

View file

@ -691,7 +691,7 @@ tr_bitfieldRemRange ( tr_bitfield * b,
}
tr_bitfield*
tr_bitfieldAnd( tr_bitfield * a, const tr_bitfield * b )
tr_bitfieldOr( tr_bitfield * a, const tr_bitfield * b )
{
uint8_t *ait;
const uint8_t *aend, *bit;
@ -699,7 +699,7 @@ tr_bitfieldAnd( tr_bitfield * a, const tr_bitfield * b )
assert( a->len == b->len );
for( ait=a->bits, bit=b->bits, aend=ait+a->len; ait!=aend; ++ait, ++bit )
*ait &= *bit;
*ait |= *bit;
return a;
}

View file

@ -150,6 +150,6 @@ int tr_bitfieldHas( const tr_bitfield*, size_t bit );
int tr_bitfieldIsEmpty( const tr_bitfield* );
size_t tr_bitfieldCountTrueBits( const tr_bitfield* );
tr_bitfield* tr_bitfieldAnd( tr_bitfield*, const tr_bitfield* );
tr_bitfield* tr_bitfieldOr( tr_bitfield*, const tr_bitfield* );
#endif