some cleanup and moved the upload_only = true to avoid failing an invariant check

This commit is contained in:
Arvid Norberg 2009-09-12 21:27:52 +00:00
parent fd6630de5a
commit ce9cf5657d
1 changed files with 52 additions and 54 deletions

View File

@ -1482,9 +1482,9 @@ namespace libtorrent
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_logger) << " got redundant HAVE message for index: " << index << "\n";
#endif
return;
}
else
{
m_have_piece.set_bit(index);
++m_num_pieces;
@ -1492,15 +1492,9 @@ namespace libtorrent
// we have the metadata and if
// we're not a seed (in which case
// we won't have a piece picker)
if (t->valid_metadata())
{
t->peer_has(index);
if (!t->valid_metadata()) return;
if (!t->have_piece(index)
&& !t->is_seed()
&& !is_interesting()
&& t->picker().piece_priority(index) != 0)
t->get_policy().peer_is_interesting(*this);
t->peer_has(index);
// this will disregard all have messages we get within
// the first two seconds. Since some clients implements
@ -1512,7 +1506,6 @@ namespace libtorrent
// update bytes downloaded since last timer
m_remote_bytes_dled += t->torrent_file().piece_size(index);
}
}
// it's important to not disconnect before we have
// updated the piece picker, otherwise we will incorrectly
@ -1525,6 +1518,12 @@ namespace libtorrent
if (is_disconnecting()) return;
}
if (!t->have_piece(index)
&& !t->is_seed()
&& !is_interesting()
&& t->picker().piece_priority(index) != 0)
t->get_policy().peer_is_interesting(*this);
// if we're super seeding, this might mean that somebody
// forwarded this piece. In which case we need to give
// a new piece to that peer
@ -1542,7 +1541,6 @@ namespace libtorrent
}
}
}
}
// -----------------------------
// --------- BITFIELD ----------