]> granicus.if.org Git - transmission/commitdiff
(trunk libT) remove unused functions: tr_bitsetDifference() tr_bitfieldDifference()
authorJordan Lee <jordan@transmissionbt.com>
Mon, 21 Feb 2011 15:36:07 +0000 (15:36 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Mon, 21 Feb 2011 15:36:07 +0000 (15:36 +0000)
libtransmission/bitfield.c
libtransmission/bitfield.h
libtransmission/bitset.c
libtransmission/bitset.h
libtransmission/peer-mgr.c

index 2563ca9a63a20a528413278c854a80c135d285d8..45b6c728bfa29616d264c8c60cab0d7d4aee7965 100644 (file)
@@ -173,19 +173,6 @@ tr_bitfieldOr( tr_bitfield * a, const tr_bitfield * b )
     return a;
 }
 
-/* set 'a' to all the flags that were in 'a' but not 'b' */
-void
-tr_bitfieldDifference( tr_bitfield * a, const tr_bitfield * b )
-{
-    uint8_t * ait = a->bits;
-    const uint8_t * aend = ait + a->byteCount;
-    const uint8_t * bit = b->bits;
-    const uint8_t * bend = bit + b->byteCount;
-
-    while( ait!=aend && bit!=bend )
-        *ait++ &= ~( *bit++ );
-}
-
 size_t
 tr_bitfieldCountTrueBits( const tr_bitfield* b )
 {
index cab952b3ebc2efa8072ab7f8730493e1c13fca65..81939a665b5a63cee00b66fdbffc966da34853a8 100644 (file)
@@ -55,8 +55,6 @@ int          tr_bitfieldAddRange( tr_bitfield *, size_t begin, size_t end );
 
 int          tr_bitfieldRemRange( tr_bitfield*, size_t begin, size_t end );
 
-void         tr_bitfieldDifference( tr_bitfield *, const tr_bitfield * );
-
 int          tr_bitfieldIsEmpty( const tr_bitfield* );
 
 size_t       tr_bitfieldCountTrueBits( const tr_bitfield* );
index 82c6360f0c8206e68fd1a81082b2d7142f3d5a48..c01d02cd72672cfa2187a64226d970789e7ec20d 100644 (file)
@@ -60,16 +60,6 @@ tr_bitsetOr( tr_bitfield * a, const tr_bitset * b )
         tr_bitfieldOr( a, &b->bitfield );
 }
 
-/* set 'a' to all the flags that were in 'a' but not 'b' */
-void
-tr_bitsetDifference( tr_bitfield * a, const tr_bitset * b )
-{
-    if( b->haveAll )
-        tr_bitfieldClear( a );
-    else if( !b->haveNone )
-        tr_bitfieldDifference( a, &b->bitfield );
-}
-
 double
 tr_bitsetPercent( const tr_bitset * b )
 {
index 7fc842975a327814a45fedaeaf3500b5a6eff49b..0afc8a98aedc89b3cb79763a2035c6e9a4a8c2c2 100644 (file)
@@ -48,7 +48,4 @@ tr_bool tr_bitsetHas( const tr_bitset * b, const size_t nth );
 
 void tr_bitsetOr( tr_bitfield * a, const tr_bitset * b );
 
-/* set 'a' to all the flags that were in 'a' but not 'b' */
-void tr_bitsetDifference( tr_bitfield * a, const tr_bitset * b );
-
 #endif
index 34c07854e3f88b97eab2a143d6fb878aef443a34..122674d106e501cf147f8098141ee930488b2b1f 100644 (file)
@@ -3105,29 +3105,8 @@ shouldPeerBeClosed( const Torrent    * t,
 
     /* if we're seeding and the peer has everything we have,
      * and enough time has passed for a pex exchange, then disconnect */
-    if( tr_torrentIsSeed( tor ) )
-    {
-        tr_bool peerHasEverything;
-
-        if( atom->seedProbability != -1 )
-        {
-            peerHasEverything = atomIsSeed( atom );
-        }
-        else
-        {
-            tr_bitfield * tmp = tr_bitfieldDup( tr_cpPieceBitfield( &tor->completion ) );
-            tr_bitsetDifference( tmp, &peer->have );
-            peerHasEverything = tr_bitfieldCountTrueBits( tmp ) == 0;
-            tr_bitfieldFree( tmp );
-        }
-
-        if( peerHasEverything && ( !tr_torrentAllowsPex(tor) || (now-atom->time>=30 )))
-        {
-            tordbg( t, "purging peer %s because we're both seeds",
-                    tr_atomAddrStr( atom ) );
-            return TRUE;
-        }
-    }
+    if( tr_torrentIsSeed( tor ) && ( peer->progress >= 1.0f ) )
+        return !tr_torrentAllowsPex(tor) || (now-atom->time>=30);
 
     /* disconnect if it's been too long since piece data has been transferred.
      * this is on a sliding scale based on number of available peers... */