From 6ddf63197f05e0b5bb8e836afb50fe476917a1a1 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 28 Jun 2009 07:39:06 +0000 Subject: [PATCH] added more asserts around outstanding bytes counter --- src/peer_connection.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 022d3bc8d..44914d341 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -1061,6 +1061,7 @@ namespace libtorrent piece_block b = i->block; bool remove_from_picker = !i->timed_out && !i->not_wanted; m_download_queue.erase(i); + TORRENT_ASSERT(m_outstanding_bytes >= r.length); m_outstanding_bytes -= r.length; // if the peer is in parole mode, keep the request @@ -1709,6 +1710,7 @@ namespace libtorrent void peer_connection::incoming_piece_fragment(int bytes) { m_last_piece = time_now(); + TORRENT_ASSERT(m_outstanding_bytes >= bytes); m_outstanding_bytes -= bytes; #ifdef TORRENT_DEBUG boost::shared_ptr t = associated_torrent().lock(); @@ -1975,6 +1977,7 @@ namespace libtorrent m_download_queue.erase(m_download_queue.begin() + i); --i; --block_index; + TORRENT_ASSERT(m_outstanding_bytes >= t->block_size()); m_outstanding_bytes -= t->block_size(); TORRENT_ASSERT(m_download_queue[block_index] == pending_b); #if !defined TORRENT_DISABLE_INVARIANT_CHECKS && defined TORRENT_DEBUG