From 6e23b9f5a63695886c66efa96a382934069e6a62 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 16 May 2011 07:47:21 +0000 Subject: [PATCH] allow torrents to keep running when they encounter an error (such as disk full) but still report the error in the torrent's error string --- src/peer_connection.cpp | 3 +-- src/session_impl.cpp | 2 +- src/torrent.cpp | 6 ++++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index bed389bae..12ea38acd 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -1149,9 +1149,8 @@ namespace libtorrent return; } - if ((t->is_paused() && (!t->is_auto_managed() + if (t->is_paused() && (!t->is_auto_managed() || !m_ses.m_settings.incoming_starts_queued_torrents)) - || t->has_error()) { // paused torrents will not accept // incoming connections unless they are auto managed diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 3f50de79c..670326762 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -2677,7 +2677,7 @@ namespace aux { { torrent& t = *i->second; TORRENT_ASSERT(!t.is_aborted()); - if (t.statistics().upload_rate() > t.upload_limit() * 9 / 10) + if (t.statistics().upload_rate() * 11 / 10 > t.upload_limit()) ++congested_torrents; else ++uncongested_torrents; diff --git a/src/torrent.cpp b/src/torrent.cpp index dc44ab53d..f64f1680f 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -1054,6 +1054,9 @@ namespace libtorrent if (alerts().should_post()) alerts().post_alert(file_error_alert(j.error_file, get_handle(), j.error)); + // put the torrent in an error-state + set_error(j.error, j.error_file); + if (j.action == disk_io_job::write) { // if we failed to write, stop downloading and just @@ -1067,8 +1070,7 @@ namespace libtorrent return; } - // put the torrent in an error-state - set_error(j.error, j.error_file); + // if the error appears to be more serious than a full disk, just pause the torrent pause(); }