From 223deaf2b6a33c2691e82ee6c283ba6b7f13a5f2 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 4 Dec 2008 03:31:14 +0000 Subject: [PATCH] (libT) #1545: 1.41b1: speed temporarily jumps to 2x the upload limit --- libtransmission/bandwidth.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libtransmission/bandwidth.c b/libtransmission/bandwidth.c index 678fb6f4d..dd5b5fed1 100644 --- a/libtransmission/bandwidth.c +++ b/libtransmission/bandwidth.c @@ -29,7 +29,7 @@ enum { HISTORY_MSEC = 2000, INTERVAL_MSEC = HISTORY_MSEC, - GRANULARITY_MSEC = 40, + GRANULARITY_MSEC = 50, HISTORY_SIZE = ( INTERVAL_MSEC / GRANULARITY_MSEC ), MAGIC_NUMBER = 43143 }; @@ -254,10 +254,14 @@ tr_bandwidthAllocate( tr_bandwidth * b, if( b->band[dir].isLimited ) { - const double currentSpeed = getSpeed( &b->band[dir].piece, HISTORY_MSEC - period_msec ); const double desiredSpeed = b->band[dir].desiredSpeed; +#if 0 + const double currentSpeed = getSpeed( &b->band[dir].piece, HISTORY_MSEC - period_msec ); const double pulseCount = ( HISTORY_MSEC - period_msec ) / (double)period_msec; const double nextPulseSpeed = desiredSpeed * ( pulseCount + 1 ) - ( currentSpeed * pulseCount ); +#else + const double nextPulseSpeed = desiredSpeed; +#endif b->band[dir].bytesLeft = MAX( 0.0, nextPulseSpeed * 1024.0 * period_msec / 1000.0 ); #ifdef DEBUG_DIRECTION