mirror of
https://github.com/transmission/transmission
synced 2025-01-31 11:23:40 +00:00
(trunk libT) minor revision to r12065: clamp the bandwidth before applying the ratio calculation
This commit is contained in:
parent
dcc070c86c
commit
f9c6deab6f
1 changed files with 3 additions and 2 deletions
|
@ -323,13 +323,14 @@ bandwidthClamp( const tr_bandwidth * b,
|
|||
double desired = tr_bandwidthGetDesiredSpeed_Bps( b, TR_DOWN );
|
||||
double r = desired > 0.001 ? current / desired : 0;
|
||||
size_t i;
|
||||
|
||||
byteCount = MIN( byteCount, b->band[dir].bytesLeft );
|
||||
|
||||
if( r > 1.0 ) i = 0;
|
||||
else if( r > 0.9 ) i = byteCount * 0.9;
|
||||
else if( r > 0.8 ) i = byteCount * 0.8;
|
||||
else i = byteCount;
|
||||
|
||||
byteCount = MIN( byteCount, b->band[dir].bytesLeft );
|
||||
|
||||
//fprintf( stderr, "--> %.4f (%f... %f) [%zu --> %zu]\n", r, current, desired, byteCount, i );
|
||||
byteCount = i;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue