rate limiter fix from lt

This commit is contained in:
Marcos Pinto 2007-08-23 16:55:25 +00:00
parent 46942d15dc
commit 441c4de1e3
1 changed files with 4 additions and 4 deletions

View File

@ -374,9 +374,8 @@ private:
// block size must be smaller for lower rates. This is because // block size must be smaller for lower rates. This is because
// the history window is one second, and the block will be forgotten // the history window is one second, and the block will be forgotten
// after one second. // after one second.
int block_size = (std::min)(qe.max_block_size int block_size = (std::min)(qe.peer->bandwidth_throttle(m_channel)
, (std::min)(qe.peer->bandwidth_throttle(m_channel) , m_limit / 10);
, m_limit / 10));
if (block_size < min_bandwidth_block_size) if (block_size < min_bandwidth_block_size)
{ {
@ -398,8 +397,8 @@ private:
block_size = m_limit block_size = m_limit
/ (m_limit / max_bandwidth_block_size); / (m_limit / max_bandwidth_block_size);
} }
if (block_size > qe.max_block_size) block_size = qe.max_block_size;
} }
if (block_size > qe.max_block_size) block_size = qe.max_block_size;
if (amount < block_size / 2) if (amount < block_size / 2)
{ {
@ -463,3 +462,4 @@ private:
#endif #endif