From 04a9dd77b553b667876dbd54b133fc71cdd23bdf Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 7 Apr 2008 08:15:31 +0000 Subject: [PATCH] assert fix --- src/peer_connection.cpp | 2 ++ src/policy.cpp | 2 ++ src/torrent.cpp | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index a35dbf85a..c39d51593 100755 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -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); diff --git a/src/policy.cpp b/src/policy.cpp index ddac0715b..94c9ad549 100755 --- a/src/policy.cpp +++ b/src/policy.cpp @@ -1206,6 +1206,8 @@ namespace libtorrent TORRENT_ASSERT(c.share_diff() < (std::numeric_limits::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(); } diff --git a/src/torrent.cpp b/src/torrent.cpp index 272dadc22..0c938bb23 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -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)