forked from premiere/premiere-libtorrent
fixed issue where torrents that failed checking would not resume checking when the error was cleared. One side effect of this fix is that it should now be possible to pause checking torrents with the 0.14 branch
This commit is contained in:
parent
3cdf9c87a8
commit
0ba2e2cdbd
|
@ -218,8 +218,6 @@ namespace libtorrent
|
||||||
torrent_status::state_t state() const { return m_state; }
|
torrent_status::state_t state() const { return m_state; }
|
||||||
void set_state(torrent_status::state_t s);
|
void set_state(torrent_status::state_t s);
|
||||||
|
|
||||||
void clear_error();
|
|
||||||
|
|
||||||
session_settings const& settings() const;
|
session_settings const& settings() const;
|
||||||
|
|
||||||
aux::session_impl& session() { return m_ses; }
|
aux::session_impl& session() { return m_ses; }
|
||||||
|
@ -247,7 +245,8 @@ namespace libtorrent
|
||||||
|
|
||||||
void ip_filter_updated() { m_policy.ip_filter_updated(); }
|
void ip_filter_updated() { m_policy.ip_filter_updated(); }
|
||||||
|
|
||||||
void set_error(std::string const& msg) { m_error = msg; }
|
void clear_error();
|
||||||
|
void set_error(std::string const& msg);
|
||||||
bool has_error() const { return !m_error.empty(); }
|
bool has_error() const { return !m_error.empty(); }
|
||||||
void pause();
|
void pause();
|
||||||
void resume();
|
void resume();
|
||||||
|
|
|
@ -1501,12 +1501,8 @@ namespace aux {
|
||||||
{
|
{
|
||||||
--hard_limit;
|
--hard_limit;
|
||||||
++total_running;
|
++total_running;
|
||||||
if (t->state() != torrent_status::queued_for_checking
|
--num_downloaders;
|
||||||
&& t->state() != torrent_status::checking_files)
|
if (t->is_paused()) t->resume();
|
||||||
{
|
|
||||||
--num_downloaders;
|
|
||||||
if (t->is_paused()) t->resume();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -580,7 +580,7 @@ namespace libtorrent
|
||||||
if (m_torrent_file->num_pieces()
|
if (m_torrent_file->num_pieces()
|
||||||
> piece_picker::max_pieces)
|
> piece_picker::max_pieces)
|
||||||
{
|
{
|
||||||
m_error = "too many pieces in torrent";
|
set_error("too many pieces in torrent");
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,7 +682,7 @@ namespace libtorrent
|
||||||
" ]\n";
|
" ]\n";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
m_error = j.str;
|
set_error(j.str);
|
||||||
pause();
|
pause();
|
||||||
set_state(torrent_status::queued_for_checking);
|
set_state(torrent_status::queued_for_checking);
|
||||||
|
|
||||||
|
@ -879,7 +879,7 @@ namespace libtorrent
|
||||||
" ]\n";
|
" ]\n";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
m_error = j.str;
|
set_error(j.str);
|
||||||
pause();
|
pause();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -923,7 +923,7 @@ namespace libtorrent
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
pause();
|
pause();
|
||||||
m_error = j.str;
|
set_error(j.str);
|
||||||
if (!m_abort) m_ses.done_checking(shared_from_this());
|
if (!m_abort) m_ses.done_checking(shared_from_this());
|
||||||
set_state(torrent_status::queued_for_checking);
|
set_state(torrent_status::queued_for_checking);
|
||||||
return;
|
return;
|
||||||
|
@ -4338,6 +4338,19 @@ namespace libtorrent
|
||||||
m_ses.check_torrent(shared_from_this());
|
m_ses.check_torrent(shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void torrent::set_error(std::string const& msg)
|
||||||
|
{
|
||||||
|
bool checking_files = should_check_files();
|
||||||
|
m_error = msg;
|
||||||
|
if (checking_files && !should_check_files())
|
||||||
|
{
|
||||||
|
// stop checking
|
||||||
|
m_storage->abort_disk_io();
|
||||||
|
m_ses.done_checking(shared_from_this());
|
||||||
|
set_state(torrent_status::queued_for_checking);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void torrent::auto_managed(bool a)
|
void torrent::auto_managed(bool a)
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
@ -4846,7 +4859,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
if (alerts().should_post<file_error_alert>())
|
if (alerts().should_post<file_error_alert>())
|
||||||
alerts().post_alert(file_error_alert(j.error_file, get_handle(), j.str));
|
alerts().post_alert(file_error_alert(j.error_file, get_handle(), j.str));
|
||||||
m_error = j.str;
|
set_error(j.str);
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
f(ret);
|
f(ret);
|
||||||
|
|
Loading…
Reference in New Issue