optimized away torrent::m_have_pieces (#62) and added some documentation on bitfield. The piece picker is now constructed with the torrent, but still freed when turned into a seed

This commit is contained in:
Arvid Norberg
2008-06-07 02:58:28 +00:00
parent bcc24bf831
commit 9d1e77dc88
12 changed files with 394 additions and 276 deletions

View File

@@ -326,15 +326,19 @@ namespace libtorrent
TORRENT_ASSERT(t);
bool interested = false;
bitfield const& we_have = t->pieces();
for (int j = 0; j != (int)we_have.size(); ++j)
if (!t->is_finished())
{
if (!we_have[j]
&& t->piece_priority(j) > 0
&& m_have_piece[j])
piece_picker const& p = t->picker();
int num_pieces = p.num_pieces();
for (int j = 0; j != num_pieces; ++j)
{
interested = true;
break;
if (!p.have_piece(j)
&& t->piece_priority(j) > 0
&& m_have_piece[j])
{
interested = true;
break;
}
}
}
try