From dc72deac3406956f4d3621cd05616832fb54ba86 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 27 Nov 2008 18:56:58 +0000 Subject: [PATCH] (libT) tweak the speed allocation a little more. --- libtransmission/bandwidth.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libtransmission/bandwidth.c b/libtransmission/bandwidth.c index 6d2c8acfa..8b4576ae2 100644 --- a/libtransmission/bandwidth.c +++ b/libtransmission/bandwidth.c @@ -254,9 +254,9 @@ tr_bandwidthAllocate( tr_bandwidth * b, if( b->band[dir].isLimited ) { - const double currentSpeed = tr_bandwidthGetPieceSpeed( b, dir ); /* KiB/s */ - const double desiredSpeed = b->band[dir].desiredSpeed; /* KiB/s */ - const double pulseCount = HISTORY_MSEC / (double)period_msec; + const double currentSpeed = getSpeed( &b->band[dir].piece, HISTORY_MSEC - period_msec ); + 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;