mirror of
https://github.com/transmission/transmission
synced 2025-03-03 18:25:35 +00:00
(trunk libT) finish r12108
This commit is contained in:
parent
c9897ff97a
commit
6b4d500c36
3 changed files with 1 additions and 25 deletions
|
@ -159,28 +159,6 @@ tr_bitsetCountRange( const tr_bitset * b, const size_t begin, const size_t end )
|
|||
return tr_bitfieldCountRange( &b->bitfield, begin, end );
|
||||
}
|
||||
|
||||
/* return true if "b" is equal to, or a superset of, "set" */
|
||||
tr_bool
|
||||
tr_bitsetHasSet( const tr_bitset * b, const tr_bitset * set )
|
||||
{
|
||||
const uint8_t * bit = b->bitfield.bits;
|
||||
const uint8_t * bend = bit + b->bitfield.byteCount;
|
||||
const uint8_t * sit = set->bitfield.bits;
|
||||
const uint8_t * send = sit + set->bitfield.byteCount;
|
||||
|
||||
if( b->haveAll || set->haveAll )
|
||||
return b->haveAll;
|
||||
|
||||
if( b->haveNone || set->haveNone )
|
||||
return set->haveNone;
|
||||
|
||||
for( ; bit!=bend && sit!=send; ++bit, ++sit )
|
||||
if( ( *bit & *sit ) != *sit )
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
double
|
||||
tr_bitsetPercent( const tr_bitset * b )
|
||||
{
|
||||
|
|
|
@ -54,7 +54,6 @@ void tr_bitsetToBenc( const tr_bitset * bitset, struct tr_benc * benc );
|
|||
double tr_bitsetPercent( const tr_bitset * b );
|
||||
|
||||
tr_bool tr_bitsetHas( const tr_bitset * b, const size_t nth );
|
||||
tr_bool tr_bitsetHasSet( const tr_bitset * b, const tr_bitset * compare );
|
||||
size_t tr_bitsetCountRange( const tr_bitset * b, const size_t begin, const size_t end );
|
||||
|
||||
void tr_bitsetOr( tr_bitfield * a, const tr_bitset * b );
|
||||
|
|
|
@ -3134,8 +3134,7 @@ shouldPeerBeClosed( const Torrent * t,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* if we're seeding and the peer has everything we have,
|
||||
* and enough time has passed for a pex exchange, then disconnect */
|
||||
/* disconnect if we're both seeds and enough time has passed for PEX */
|
||||
if( tr_torrentIsSeed( tor ) && ( peer->progress >= 1.0f ) )
|
||||
return !tr_torrentAllowsPex(tor) || (now-atom->time>=30);
|
||||
|
||||
|
|
Loading…
Reference in a new issue