mirror of
https://github.com/transmission/transmission
synced 2025-01-31 11:23:40 +00:00
(libT) fix potential underflow in bandwidth allocation code
This commit is contained in:
parent
ca433d44ae
commit
b3c4061b1c
1 changed files with 1 additions and 1 deletions
|
@ -258,7 +258,7 @@ tr_bandwidthAllocate( tr_bandwidth * b,
|
|||
const double desiredSpeed = b->band[dir].desiredSpeed;
|
||||
const double pulseCount = ( HISTORY_MSEC - period_msec ) / (double)period_msec;
|
||||
const double nextPulseSpeed = desiredSpeed * ( pulseCount + 1 ) - ( currentSpeed * pulseCount );
|
||||
b->band[dir].bytesLeft = nextPulseSpeed * 1024.0 * period_msec / 1000.0;
|
||||
b->band[dir].bytesLeft = MAX( 0.0, nextPulseSpeed * 1024.0 * period_msec / 1000.0 );
|
||||
|
||||
#ifdef DEBUG_DIRECTION
|
||||
if( dir == DEBUG_DIRECTION )
|
||||
|
|
Loading…
Reference in a new issue