introduced an error state for torrents. Torrents with an error are not restarted automatically
This commit is contained in:
parent
aed8f355b0
commit
67354421fb
|
@ -2206,6 +2206,8 @@ struct torrent_status
|
|||
state_t state;
|
||||
bool paused;
|
||||
float progress;
|
||||
std::string error;
|
||||
|
||||
boost::posix_time::time_duration next_announce;
|
||||
boost::posix_time::time_duration announce_interval;
|
||||
|
||||
|
@ -2319,6 +2321,9 @@ allocated.</td>
|
|||
</table>
|
||||
<p>When downloading, the progress is <tt class="docutils literal"><span class="pre">total_wanted_done</span></tt> / <tt class="docutils literal"><span class="pre">total_wanted</span></tt>.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">paused</span></tt> is set to true if the torrent is paused and false otherwise.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">error</span></tt> may be set to an error message describing why the torrent was paused, in
|
||||
case it was paused by an error. If the torrent is not paused or if it's paused but
|
||||
not because of an error, this string is empty.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">next_announce</span></tt> is the time until the torrent will announce itself to the tracker. And
|
||||
<tt class="docutils literal"><span class="pre">announce_interval</span></tt> is the time the tracker want us to wait until we announce ourself
|
||||
again the next time.</p>
|
||||
|
|
|
@ -2170,6 +2170,8 @@ It contains the following fields::
|
|||
state_t state;
|
||||
bool paused;
|
||||
float progress;
|
||||
std::string error;
|
||||
|
||||
boost::posix_time::time_duration next_announce;
|
||||
boost::posix_time::time_duration announce_interval;
|
||||
|
||||
|
@ -2273,6 +2275,10 @@ When downloading, the progress is ``total_wanted_done`` / ``total_wanted``.
|
|||
|
||||
``paused`` is set to true if the torrent is paused and false otherwise.
|
||||
|
||||
``error`` may be set to an error message describing why the torrent was paused, in
|
||||
case it was paused by an error. If the torrent is not paused or if it's paused but
|
||||
not because of an error, this string is empty.
|
||||
|
||||
``next_announce`` is the time until the torrent will announce itself to the tracker. And
|
||||
``announce_interval`` is the time the tracker want us to wait until we announce ourself
|
||||
again the next time.
|
||||
|
|
|
@ -1253,6 +1253,13 @@ int main(int ac, char* av[])
|
|||
bool paused = h.is_paused();
|
||||
bool auto_managed = h.is_auto_managed();
|
||||
out << std::setw(13) << std::setiosflags(std::ios::left);
|
||||
if (!s.error.empty())
|
||||
{
|
||||
out << esc("31") << "error " << s.error;
|
||||
out << esc("0") << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (paused && !auto_managed) out << "paused";
|
||||
else if (paused && auto_managed) out << "queued";
|
||||
else
|
||||
|
|
|
@ -181,6 +181,7 @@ namespace libtorrent
|
|||
|
||||
void ip_filter_updated() { m_policy.ip_filter_updated(); }
|
||||
|
||||
bool has_error() const { return !m_error.empty(); }
|
||||
void pause();
|
||||
void resume();
|
||||
bool is_paused() const { return m_paused; }
|
||||
|
@ -750,6 +751,10 @@ namespace libtorrent
|
|||
// the state of this torrent (queued, checking, downloading)
|
||||
torrent_status::state_t m_state;
|
||||
|
||||
// if there's an error on this torrent, this is the
|
||||
// error message
|
||||
std::string m_error;
|
||||
|
||||
entry m_resume_data;
|
||||
|
||||
// if the torrent is started without metadata, it may
|
||||
|
|
|
@ -137,6 +137,8 @@ namespace libtorrent
|
|||
state_t state;
|
||||
bool paused;
|
||||
float progress;
|
||||
std::string error;
|
||||
|
||||
boost::posix_time::time_duration next_announce;
|
||||
boost::posix_time::time_duration announce_interval;
|
||||
|
||||
|
|
|
@ -1043,7 +1043,7 @@ namespace aux {
|
|||
else
|
||||
++uncongested_torrents;
|
||||
|
||||
if (t.is_auto_managed() && t.is_paused())
|
||||
if (t.is_auto_managed() && t.is_paused() && !t.has_error())
|
||||
{
|
||||
++num_paused_auto_managed;
|
||||
if (!least_recently_scraped->second->is_auto_managed()
|
||||
|
@ -1308,7 +1308,7 @@ namespace aux {
|
|||
{
|
||||
torrent* t = i->second.get();
|
||||
TORRENT_ASSERT(t);
|
||||
if (t->is_auto_managed())
|
||||
if (t->is_auto_managed() && !t->has_error())
|
||||
{
|
||||
// this torrent is auto managed, add it to
|
||||
// the list (depending on if it's a seed or not)
|
||||
|
|
|
@ -449,7 +449,7 @@ namespace libtorrent
|
|||
}
|
||||
std::fill(m_have_pieces.begin(), m_have_pieces.end(), false);
|
||||
m_num_pieces = 0;
|
||||
auto_managed(false);
|
||||
m_error = j.str;
|
||||
pause();
|
||||
return;
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ namespace libtorrent
|
|||
}
|
||||
std::fill(m_have_pieces.begin(), m_have_pieces.end(), false);
|
||||
m_num_pieces = 0;
|
||||
auto_managed(false);
|
||||
m_error = j.str;
|
||||
pause();
|
||||
m_ses.done_checking(shared_from_this());
|
||||
return;
|
||||
|
@ -3564,6 +3564,7 @@ namespace libtorrent
|
|||
|
||||
m_paused = false;
|
||||
m_started = time_now();
|
||||
m_error.clear();
|
||||
|
||||
// tell the tracker that we're back
|
||||
m_event = tracker_request::started;
|
||||
|
@ -3750,6 +3751,7 @@ namespace libtorrent
|
|||
{
|
||||
alerts().post_alert(file_error_alert(j.error_file, get_handle(), j.str));
|
||||
}
|
||||
m_error = j.str;
|
||||
pause();
|
||||
}
|
||||
f(ret);
|
||||
|
@ -3809,6 +3811,8 @@ namespace libtorrent
|
|||
|
||||
torrent_status st;
|
||||
|
||||
st.error = m_error;
|
||||
|
||||
if (m_last_scrape == min_time())
|
||||
{
|
||||
st.last_scrape = -1;
|
||||
|
|
Loading…
Reference in New Issue