modified and enabled invariant checking for piece_picker

This commit is contained in:
Arvid Norberg 2007-03-29 00:52:16 +00:00
parent ceadb93097
commit fc46a731eb
2 changed files with 11 additions and 11 deletions

View File

@ -1094,7 +1094,7 @@ namespace libtorrent
// in case we just became a seed
t->announce_piece(p.piece);
assert(t->valid_metadata());
// if we jsut became a seed, picker is now invalid, since it
// if we just became a seed, picker is now invalid, since it
// is deallocated by the torrent once it starts seeding
if (!was_finished
&& (t->is_seed()

View File

@ -48,8 +48,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/torrent.hpp"
#endif
//#define TORRENT_PIECE_PICKER_INVARIANT_CHECK INVARIANT_CHECK
#define TORRENT_PIECE_PICKER_INVARIANT_CHECK
#define TORRENT_PIECE_PICKER_INVARIANT_CHECK INVARIANT_CHECK
//#define TORRENT_PIECE_PICKER_INVARIANT_CHECK
namespace libtorrent
{
@ -215,6 +215,7 @@ namespace libtorrent
else
++num_have_filtered;
}
#if 0
if (t != 0)
{
int actual_peer_count = 0;
@ -247,7 +248,8 @@ namespace libtorrent
}
*/
}
#endif
/*
if (i->index == piece_pos::we_have_index)
{
assert(t == 0 || t->have_piece(index));
@ -286,18 +288,16 @@ namespace libtorrent
}
}
}
std::vector<downloading_piece>::const_iterator down
= std::find_if(m_downloads.begin(),
m_downloads.end(),
has_index(index));
*/
int count = std::count_if(m_downloads.begin(), m_downloads.end()
, has_index(index));
if (i->downloading == 1)
{
assert(down != m_downloads.end());
assert(count == 1);
}
else
{
assert(down == m_downloads.end());
assert(count == 0);
}
}
assert(num_filtered == m_num_filtered);