assert fix

This commit is contained in:
Arvid Norberg 2008-04-07 08:15:31 +00:00
parent 6fa3d37e83
commit 04a9dd77b5
3 changed files with 8 additions and 0 deletions

View File

@ -3185,6 +3185,8 @@ namespace libtorrent
TORRENT_ASSERT(unique.size() == m_download_queue.size() + m_request_queue.size());
if (m_peer_info)
{
TORRENT_ASSERT(m_peer_info->prev_amount_upload == 0);
TORRENT_ASSERT(m_peer_info->prev_amount_download == 0);
TORRENT_ASSERT(m_peer_info->connection == this
|| m_peer_info->connection == 0);

View File

@ -1206,6 +1206,8 @@ namespace libtorrent
TORRENT_ASSERT(c.share_diff() < (std::numeric_limits<size_type>::max)());
m_available_free_upload += c.share_diff();
}
TORRENT_ASSERT(p->prev_amount_upload == 0);
TORRENT_ASSERT(p->prev_amount_download == 0);
p->prev_amount_download += c.statistics().total_payload_download();
p->prev_amount_upload += c.statistics().total_payload_upload();
}

View File

@ -2311,6 +2311,10 @@ namespace libtorrent
c->m_in_constructor = false;
#endif
c->add_stat(peerinfo->prev_amount_download, peerinfo->prev_amount_upload);
peerinfo->prev_amount_download = 0;
peerinfo->prev_amount_upload = 0;
#ifndef TORRENT_DISABLE_EXTENSIONS
for (extension_list_t::iterator i = m_extensions.begin()
, end(m_extensions.end()); i != end; ++i)