some more asserts

This commit is contained in:
Arvid Norberg 2007-08-19 08:23:44 +00:00
parent 88cd663895
commit da525292fe
2 changed files with 6 additions and 0 deletions

View File

@ -828,6 +828,8 @@ namespace libtorrent
, end(m_piece_map.end()); i != end; ++i) , end(m_piece_map.end()); i != end; ++i)
{ {
int prev_prio = i->priority(m_sequenced_download_threshold); int prev_prio = i->priority(m_sequenced_download_threshold);
assert(prev_prio < m_piece_info.size());
assert(pushed_out_index < m_piece_info.size());
assert(i->peer_count > 0); assert(i->peer_count > 0);
--i->peer_count; --i->peer_count;
// if the assumption that the priority would // if the assumption that the priority would

View File

@ -1140,6 +1140,7 @@ namespace detail
if (pi->optimistically_unchoked) if (pi->optimistically_unchoked)
{ {
assert(!p->is_choked());
assert(current_optimistic_unchoke == m_connections.end()); assert(current_optimistic_unchoke == m_connections.end());
current_optimistic_unchoke = i; current_optimistic_unchoke = i;
} }
@ -2129,7 +2130,10 @@ namespace detail
if (!i->second->is_choked()) ++unchokes; if (!i->second->is_choked()) ++unchokes;
if (i->second->peer_info_struct() if (i->second->peer_info_struct()
&& i->second->peer_info_struct()->optimistically_unchoked) && i->second->peer_info_struct()->optimistically_unchoked)
{
++num_optimistic; ++num_optimistic;
assert(!i->second->is_choked());
}
if (t) if (t)
{ {
assert(t->get_policy().has_connection(boost::get_pointer(i->second))); assert(t->get_policy().has_connection(boost::get_pointer(i->second)));