lt sync 2613

This commit is contained in:
Andrew Resch 2008-08-19 07:22:20 +00:00
parent d8b0fb5885
commit 90a4b3e1ed
3 changed files with 25 additions and 24 deletions

View File

@ -166,7 +166,7 @@ namespace libtorrent
virtual std::string message() const
{
static char const* state_str[] =
{"checking (q)", "checking", "connecting", "dl metadata"
{"checking (q)", "checking", "dl metadata"
, "downloading", "finished", "seeding", "allocating"};
return torrent_alert::message() + ": state changed to: "

View File

@ -1099,7 +1099,7 @@ namespace libtorrent
p.piece_priority = new_piece_priority;
int new_priority = p.priority(this);
if (prev_priority == new_priority) return false;
if (prev_priority == new_priority) return ret;
TORRENT_ASSERT(prev_priority < int(m_priority_boundries.size()));

View File

@ -1800,7 +1800,6 @@ namespace libtorrent
INVARIANT_CHECK;
if (m_torrent_file->num_pieces() == 0) return;
bool was_finished = is_finished();
size_type position = 0;
int piece_length = m_torrent_file->piece_length();
@ -1826,7 +1825,6 @@ namespace libtorrent
, bind(&set_if_greater, _1, m_file_priority[i]));
}
prioritize_pieces(pieces);
update_peer_interest(was_finished);
}
// this is called when piece priorities have been updated
@ -1836,16 +1834,18 @@ namespace libtorrent
for (peer_iterator i = begin(); i != end(); ++i)
(*i)->update_interest();
// if we used to be finished, but we aren't anymore
// we may need to connect to peers again
if (!is_finished() && was_finished)
m_policy.recalculate_connect_candidates();
// the torrent just became finished
if (is_finished() && !was_finished)
{
finished();
}
else if (!is_finished() && was_finished)
{
// if we used to be finished, but we aren't anymore
// we may need to connect to peers again
resume_download();
m_policy.recalculate_connect_candidates();
}
}
void torrent::filter_piece(int index, bool filter)
@ -3265,6 +3265,12 @@ namespace libtorrent
set_state(torrent_status::downloading);
if (m_ses.m_alerts.should_post<torrent_checked_alert>())
{
m_ses.m_alerts.post_alert(torrent_checked_alert(
get_handle()));
}
if (!is_seed())
{
if (m_sequential_download)
@ -3274,6 +3280,13 @@ namespace libtorrent
// likely to be unpaused
if (m_ses.m_auto_manage_time_scaler > 1)
m_ses.m_auto_manage_time_scaler = 1;
if (is_finished()) finished();
}
else
{
m_complete_sent = true;
finished();
}
#ifndef TORRENT_DISABLE_EXTENSIONS
@ -3290,12 +3303,6 @@ namespace libtorrent
}
#endif
if (is_seed())
{
m_complete_sent = true;
finished();
}
if (!m_connections_initialized)
{
m_connections_initialized = true;
@ -3311,12 +3318,6 @@ namespace libtorrent
}
}
if (m_ses.m_alerts.should_post<torrent_checked_alert>())
{
m_ses.m_alerts.post_alert(torrent_checked_alert(
get_handle()));
}
m_files_checked = true;
start_announcing();