(libT) #1545: 1.41b1: speed temporarily jumps to 2x the upload limit

This commit is contained in:
Charles Kerr 2008-12-04 03:31:14 +00:00
parent 11e3957887
commit 223deaf2b6
1 changed files with 6 additions and 2 deletions

View File

@ -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