fixed invalid iterator access in debug mode

This commit is contained in:
Arvid Norberg 2009-04-25 08:19:21 +00:00
parent 679a594f4e
commit fba4ae541c
2 changed files with 8 additions and 2 deletions

View File

@ -111,6 +111,12 @@ namespace libtorrent
bool timed_out:1;
piece_block block;
bool operator==(pending_block const& b)
{
return b.skipped == skipped && b.block == block
&& b.not_wanted == not_wanted && b.timed_out == timed_out;
}
};
struct has_block

View File

@ -1731,7 +1731,7 @@ namespace libtorrent
if (t->alerts().should_post<unwanted_block_alert>())
{
t->alerts().post_alert(unwanted_block_alert(t->get_handle(), m_remote
, m_peer_id, b.block_index, b.piece_index));
, m_peer_id, b.block_index, b.piece_index));
}
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_logger) << " *** The block we just got was not in the "
@ -1936,7 +1936,7 @@ namespace libtorrent
if (!qe.timed_out && !qe.not_wanted)
picker.abort_download(qe.block);
TORRENT_ASSERT(m_download_queue.begin() + i != b);
TORRENT_ASSERT(m_download_queue[block_index] == pending_b);
m_download_queue.erase(m_download_queue.begin() + i);
--i;
--block_index;