fixed checking files issue

This commit is contained in:
Arvid Norberg 2009-02-03 17:35:41 +00:00
parent 1ac8f806fa
commit 532a5f477d
2 changed files with 35 additions and 35 deletions

View File

@ -1933,18 +1933,21 @@ namespace aux {
INVARIANT_CHECK;
if (m_queued_for_checking.empty()) return;
check_queue_t::iterator next_check = m_queued_for_checking.begin();
boost::shared_ptr<torrent> next_check = *m_queued_for_checking.begin();
check_queue_t::iterator done = m_queued_for_checking.end();
for (check_queue_t::iterator i = m_queued_for_checking.begin()
, end(m_queued_for_checking.end()); i != end; ++i)
{
TORRENT_ASSERT(*i == t || (*i)->should_check_files());
if (*i == t) done = i;
if (next_check == done || (*next_check)->queue_position() > (*i)->queue_position())
next_check = i;
if (next_check == t || next_check->queue_position() > (*i)->queue_position())
next_check = *i;
}
// only start a new one if we removed the one that is checking
if (next_check != done && t->state() == torrent_status::checking_files) (*next_check)->start_checking();
if (done == m_queued_for_checking.end()) return;
if (next_check != t && t->state() == torrent_status::checking_files)
next_check->start_checking();
m_queued_for_checking.erase(done);
}

View File

@ -559,12 +559,12 @@ namespace libtorrent
if (error && m_ses.m_alerts.should_post<fastresume_rejected_alert>())
{
m_ses.m_alerts.post_alert(fastresume_rejected_alert(get_handle(), error));
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_ses.m_logger) << "fastresume data for "
<< torrent_file().name() << " rejected: "
<< error << "\n";
#endif
}
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_ses.m_logger) << "fastresume data for "
<< torrent_file().name() << " rejected: "
<< error << "\n";
#endif
if (error)
{
@ -613,13 +613,13 @@ namespace libtorrent
if (m_ses.m_alerts.should_post<file_error_alert>())
{
m_ses.m_alerts.post_alert(file_error_alert(j.error_file, get_handle(), j.str));
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_ses.m_logger) << time_now_string() << ": fatal disk error ["
" error: " << j.str <<
" torrent: " << torrent_file().name() <<
" ]\n";
#endif
}
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_ses.m_logger) << time_now_string() << ": fatal disk error ["
" error: " << j.str <<
" torrent: " << torrent_file().name() <<
" ]\n";
#endif
set_error(j.str);
pause();
set_state(torrent_status::queued_for_checking);
@ -677,12 +677,12 @@ namespace libtorrent
if (fastresume_rejected && m_ses.m_alerts.should_post<fastresume_rejected_alert>())
{
m_ses.m_alerts.post_alert(fastresume_rejected_alert(get_handle(), j.str));
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_ses.m_logger) << "fastresume data for "
<< torrent_file().name() << " rejected: "
<< j.str << "\n";
#endif
}
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_ses.m_logger) << "fastresume data for "
<< torrent_file().name() << " rejected: "
<< j.str << "\n";
#endif
if (ret == 0)
{
@ -810,13 +810,13 @@ namespace libtorrent
if (m_ses.m_alerts.should_post<file_error_alert>())
{
m_ses.m_alerts.post_alert(file_error_alert(j.error_file, get_handle(), j.str));
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_ses.m_logger) << time_now_string() << ": fatal disk error ["
" error: " << j.str <<
" torrent: " << torrent_file().name() <<
" ]\n";
#endif
}
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_ses.m_logger) << time_now_string() << ": fatal disk error ["
" error: " << j.str <<
" torrent: " << torrent_file().name() <<
" ]\n";
#endif
set_error(j.str);
pause();
return;
@ -841,7 +841,6 @@ namespace libtorrent
void torrent::on_piece_checked(int ret, disk_io_job const& j)
{
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
INVARIANT_CHECK;
if (ret == piece_manager::disk_check_aborted)
@ -853,17 +852,15 @@ namespace libtorrent
if (m_ses.m_alerts.should_post<file_error_alert>())
{
m_ses.m_alerts.post_alert(file_error_alert(j.error_file, get_handle(), j.str));
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_ses.m_logger) << time_now_string() << ": fatal disk error ["
" error: " << j.str <<
" torrent: " << torrent_file().name() <<
" ]\n";
#endif
}
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_ses.m_logger) << time_now_string() << ": fatal disk error ["
" error: " << j.str <<
" torrent: " << torrent_file().name() <<
" ]\n";
#endif
pause();
set_error(j.str);
if (!m_abort) m_ses.done_checking(shared_from_this());
set_state(torrent_status::queued_for_checking);
return;
}