mirror of
https://github.com/transmission/transmission
synced 2025-03-09 13:50:00 +00:00
avoid calculations if the bandwidth limit is 0, since it always will return the same value
This commit is contained in:
parent
dc68861f60
commit
5e17b596d6
1 changed files with 3 additions and 3 deletions
|
@ -97,9 +97,9 @@ int tr_rcCanGlobalTransfer( tr_handle_t * h, int isUpload )
|
||||||
float rate = 0;
|
float rate = 0;
|
||||||
int limit = isUpload ? h->uploadLimit : h->downloadLimit;
|
int limit = isUpload ? h->uploadLimit : h->downloadLimit;
|
||||||
|
|
||||||
if( limit < 0 )
|
if( limit <= 0 )
|
||||||
{
|
{
|
||||||
return 1;
|
return limit < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( tor = h->torrentList; tor; tor = tor->next )
|
for( tor = h->torrentList; tor; tor = tor->next )
|
||||||
|
@ -135,7 +135,7 @@ int tr_rcCanTransfer( tr_ratecontrol_t * r )
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
tr_lockLock( &r->lock );
|
tr_lockLock( &r->lock );
|
||||||
ret = ( r->limit < 0 ) || ( rateForInterval( r, 1000 ) < r->limit );
|
ret = ( r->limit <= 0 ) ? ( r->limit < 0 ) : ( rateForInterval( r, 1000 ) < r->limit );
|
||||||
tr_lockUnlock( &r->lock );
|
tr_lockUnlock( &r->lock );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Reference in a new issue