fixed one incorrect assert

This commit is contained in:
Arvid Norberg 2007-03-30 19:18:03 +00:00
parent b8721ad854
commit e6a4733392
1 changed files with 18 additions and 19 deletions

View File

@ -652,8 +652,7 @@ namespace libtorrent
m_downloads.erase(i); m_downloads.erase(i);
p.downloading = 0; p.downloading = 0;
assert(std::find_if(m_downloads.begin() assert(std::find_if(m_downloads.begin(), m_downloads.end()
, m_downloads.end()
, has_index(index)) == m_downloads.end()); , has_index(index)) == m_downloads.end());
if (p.filtered()) if (p.filtered())
@ -698,9 +697,8 @@ namespace libtorrent
has_index(index)); has_index(index));
assert(i != m_downloads.end()); assert(i != m_downloads.end());
m_downloads.erase(i); m_downloads.erase(i);
assert(std::find_if(m_downloads.begin(), assert(std::find_if(m_downloads.begin(), m_downloads.end()
m_downloads.end(), , has_index(index)) == m_downloads.end());
has_index(index)) == m_downloads.end());
} }
p.downloading = 0; p.downloading = 0;
} }
@ -935,8 +933,8 @@ namespace libtorrent
if (m_piece_map[index].downloading == 0) if (m_piece_map[index].downloading == 0)
{ {
assert(std::find_if(m_downloads.begin(), m_downloads.end(), has_index(index)) assert(std::find_if(m_downloads.begin(), m_downloads.end()
== m_downloads.end()); , has_index(index)) == m_downloads.end());
return false; return false;
} }
std::vector<downloading_piece>::const_iterator i std::vector<downloading_piece>::const_iterator i
@ -1125,23 +1123,24 @@ namespace libtorrent
if (m_piece_map[block.piece_index].downloading == 0) if (m_piece_map[block.piece_index].downloading == 0)
{ {
assert(std::find_if(m_downloads.begin(), m_downloads.end(), has_index(block.piece_index)) == m_downloads.end()); assert(std::find_if(m_downloads.begin(), m_downloads.end()
, has_index(block.piece_index)) == m_downloads.end());
return; return;
} }
std::vector<downloading_piece>::iterator i std::vector<downloading_piece>::iterator i = std::find_if(m_downloads.begin()
= std::find_if(m_downloads.begin(), m_downloads.end(), has_index(block.piece_index)); , m_downloads.end(), has_index(block.piece_index));
assert(i != m_downloads.end()); assert(i != m_downloads.end());
if (i->finished_blocks[block.block_index]) return; if (i->finished_blocks[block.block_index])
{
assert(std::find_if(m_downloads.begin(), m_downloads.end()
, has_index(block.piece_index)) == m_downloads.end());
return;
}
assert(block.block_index < blocks_in_piece(block.piece_index)); assert(block.block_index < blocks_in_piece(block.piece_index));
#ifndef NDEBUG assert(i->requested_blocks[block.block_index]);
if (i->requested_blocks[block.block_index] == false)
{
assert(false);
}
#endif
// clear this block as being downloaded // clear this block as being downloaded
i->requested_blocks[block.block_index] = false; i->requested_blocks[block.block_index] = false;
@ -1159,8 +1158,8 @@ namespace libtorrent
p.downloading = 0; p.downloading = 0;
move(prio, p.index); move(prio, p.index);
assert(std::find_if(m_downloads.begin(), assert(std::find_if(m_downloads.begin(), m_downloads.end()
m_downloads.end(), has_index(p.index)) == m_downloads.end()); , has_index(block.piece_index)) == m_downloads.end());
} }
} }