mirror of
https://github.com/transmission/transmission
synced 2025-01-31 19:34:05 +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 desired = tr_bandwidthGetDesiredSpeed_Bps( b, TR_DOWN );
|
||||||
double r = desired > 0.001 ? current / desired : 0;
|
double r = desired > 0.001 ? current / desired : 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
byteCount = MIN( byteCount, b->band[dir].bytesLeft );
|
||||||
|
|
||||||
if( r > 1.0 ) i = 0;
|
if( r > 1.0 ) i = 0;
|
||||||
else if( r > 0.9 ) i = byteCount * 0.9;
|
else if( r > 0.9 ) i = byteCount * 0.9;
|
||||||
else if( r > 0.8 ) i = byteCount * 0.8;
|
else if( r > 0.8 ) i = byteCount * 0.8;
|
||||||
else i = byteCount;
|
else i = byteCount;
|
||||||
|
|
||||||
byteCount = MIN( byteCount, b->band[dir].bytesLeft );
|
|
||||||
|
|
||||||
//fprintf( stderr, "--> %.4f (%f... %f) [%zu --> %zu]\n", r, current, desired, byteCount, i );
|
//fprintf( stderr, "--> %.4f (%f... %f) [%zu --> %zu]\n", r, current, desired, byteCount, i );
|
||||||
byteCount = i;
|
byteCount = i;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue