fixed bug in stat patch

This commit is contained in:
Arvid Norberg 2010-10-24 02:45:47 +00:00
parent 6387910a42
commit 786af218e1
1 changed files with 3 additions and 1 deletions

View File

@ -41,9 +41,11 @@ namespace libtorrent {
void stat_channel::second_tick(int tick_interval_ms) void stat_channel::second_tick(int tick_interval_ms)
{ {
if (m_counter == 0) return;
int sample = int(size_type(m_counter) * 1000 / tick_interval_ms); int sample = int(size_type(m_counter) * 1000 / tick_interval_ms);
TORRENT_ASSERT(sample >= 0); TORRENT_ASSERT(sample >= 0);
m_average = m_average * 4 / 3 + sample / 4; m_average = m_average * 3 / 4 + sample / 4;
m_counter = 0; m_counter = 0;
} }