]> granicus.if.org Git - transmission/commitdiff
(libT) revise r7065
authorCharles Kerr <charles@transmissionbt.com>
Fri, 7 Nov 2008 05:37:59 +0000 (05:37 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Fri, 7 Nov 2008 05:37:59 +0000 (05:37 +0000)
libtransmission/peer-mgr.c
libtransmission/peer-msgs.c
libtransmission/torrent.c
libtransmission/torrent.h

index dfff582795faf011bfda81d74ec67f3480311db0..6571207b430c9d5d431e31d74cbcad796e6561f8 100644 (file)
@@ -1891,7 +1891,7 @@ rechoke( Torrent * t )
     int                i, peerCount, size, unchokedInterested;
     tr_peer **         peers = getConnectedPeers( t, &peerCount );
     struct ChokeData * choke = tr_new0( struct ChokeData, peerCount );
-    const int          chokeAll = !tr_torrentPieceTransferIsAllowed( t->tor, TR_CLIENT_TO_PEER );
+    const int          chokeAll = !tr_torrentIsPieceTransferAllowed( t->tor, TR_CLIENT_TO_PEER );
 
     assert( torrentIsLocked( t ) );
 
@@ -2519,7 +2519,7 @@ allocateBandwidth( tr_peerMgr * mgr,
 
         /* if piece data is disallowed, don't bother limiting bandwidth --
          * we won't be asking for, or sending out, any pieces */
-        if( !tr_torrentPieceTransferIsAllowed( t->tor, direction ) )
+        if( !tr_torrentIsPieceTransferAllowed( t->tor, direction ) )
             speedMode = TR_SPEEDLIMIT_UNLIMITED;
         else
             speedMode = tr_torrentGetSpeedMode( t->tor, direction );
index ed55faa9dd981f5a73dd2b4f87edb1f5715d6691..fc783940ba2a95d710125e303e76fa6956baacd6 100644 (file)
@@ -542,7 +542,7 @@ isPeerInteresting( const tr_peermsgs * msgs )
     if( clientIsSeed )
         return FALSE;
 
-    if( !tr_torrentPieceTransferIsAllowed( msgs->torrent, TR_PEER_TO_CLIENT ) )
+    if( !tr_torrentIsPieceTransferAllowed( msgs->torrent, TR_PEER_TO_CLIENT ) )
         return FALSE;
 
     torrent = msgs->torrent;
@@ -813,7 +813,7 @@ pumpRequestQueue( tr_peermsgs * msgs, const time_t now )
         return;
     if( msgs->info->clientIsChoked )
         return;
-    if( !tr_torrentPieceTransferIsAllowed( msgs->torrent, TR_PEER_TO_CLIENT ) )
+    if( !tr_torrentIsPieceTransferAllowed( msgs->torrent, TR_PEER_TO_CLIENT ) )
         return;
 
     while( ( count < max ) && reqListPop( &msgs->clientWillAskFor, &req ) )
index bf8f632255b97eb8d2fb92830253a0c9da7bcad1..bbb9abf72e7e61ce6ae5404f33f1c710ba4d6fe6 100644 (file)
@@ -195,7 +195,7 @@ tr_torrentGetSpeedLimit( const tr_torrent * tor,
 }
 
 int
-tr_torrentPieceTransferIsAllowed( const tr_torrent  * tor,
+tr_torrentIsPieceTransferAllowed( const tr_torrent  * tor,
                                   tr_direction        direction )
 {
     int isEnabled = FALSE;
@@ -203,7 +203,8 @@ tr_torrentPieceTransferIsAllowed( const tr_torrent  * tor,
     switch( tr_torrentGetSpeedMode( tor, direction ) )
     {
         case TR_SPEEDLIMIT_GLOBAL:
-            isEnabled = tr_sessionGetSpeedLimit( tor->session, direction ) > 0;
+            isEnabled = !tr_sessionIsSpeedLimitEnabled( tor->session, direction )
+                      || tr_sessionGetSpeedLimit( tor->session, direction ) > 0;
             break;
 
         case TR_SPEEDLIMIT_SINGLE:
index 678d1b12677d249ca606180ac5c73e232ae7f846..c06d8264ab6e3be57f06aeea3e5b6b91642ce882 100644 (file)
@@ -81,7 +81,7 @@ tr_torrent* tr_torrentFindFromObfuscatedHash( tr_session    * session,
 
 int         tr_torrentAllowsPex( const tr_torrent * );
 
-int         tr_torrentPieceTransferIsAllowed( const tr_torrent * torrent,
+int         tr_torrentIsPieceTransferAllowed( const tr_torrent * torrent,
                                               tr_direction       direction );
 
 /* get the index of this piece's first block */