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 ) );
/* 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 );
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;
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 ) )
}
int
-tr_torrentPieceTransferIsAllowed( const tr_torrent * tor,
+tr_torrentIsPieceTransferAllowed( const tr_torrent * tor,
tr_direction direction )
{
int isEnabled = FALSE;
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:
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 */