clears torrent stats when paused

This commit is contained in:
Arvid Norberg 2008-10-15 17:31:20 +00:00
parent 7d18a3fd11
commit 16d56eaee6
2 changed files with 15 additions and 0 deletions

View File

@ -87,6 +87,14 @@ namespace libtorrent
size_type counter() const { return m_counter; } size_type counter() const { return m_counter; }
void clear()
{
std::memset(m_rate_history, 0, sizeof(m_rate_history));
m_counter = 0;
m_total_counter = 0;
m_rate_sum = 0;
}
private: private:
#ifndef NDEBUG #ifndef NDEBUG
@ -306,6 +314,12 @@ namespace libtorrent
num_channels num_channels
}; };
void clear()
{
for (int i = 0; i < num_channels; ++i)
m_stat[i].clear();
}
private: private:
stat_channel m_stat[num_channels]; stat_channel m_stat[num_channels];

View File

@ -4112,6 +4112,7 @@ namespace libtorrent
{ {
// tell the tracker that we're back // tell the tracker that we're back
m_start_sent = false; m_start_sent = false;
m_stat.clear();
announce_with_tracker(); announce_with_tracker();
} }