mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-07 06:39:23 +00:00
* Added "stop_on_ratio" option and display the ratio. Patch by Josef
Drexler, public domain. * Made autogen.sh detect glibtoolize. * Don't resume torrents that are marked as completed yet the initial hash check returns failed chunks. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@704 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -100,6 +100,8 @@ Download::Download(download_type d) :
|
||||
rak::mem_fn(&m_download, &download_type::set_uploads_max)));
|
||||
m_variables.insert("priority", new utils::VariableValueSlot(rak::mem_fn(this, &Download::priority),
|
||||
rak::mem_fn(this, &Download::set_priority)));
|
||||
|
||||
m_variables.insert("ignore_ratio", new utils::VariableObject(bencode(), "rtorrent", "ignore_ratio", torrent::Object::TYPE_VALUE));
|
||||
}
|
||||
|
||||
Download::~Download() {
|
||||
|
||||
@@ -67,6 +67,7 @@ public:
|
||||
bool is_active() const { return m_download.is_active(); }
|
||||
bool is_done() const { return m_download.chunks_done() == m_download.chunks_total(); }
|
||||
bool is_downloading() const { return is_active() && !is_done(); }
|
||||
bool is_seeding() const { return is_active() && is_done(); }
|
||||
|
||||
// FIXME: Fixed a bug in libtorrent that caused is_hash_checked to
|
||||
// return true when the torrent is closed. Remove this redundant
|
||||
|
||||
@@ -264,6 +264,9 @@ DownloadFactory::initialize_rtorrent(Download* download, torrent::Object* rtorre
|
||||
|
||||
if (rtorrent->has_key_value("total_uploaded"))
|
||||
download->download()->up_rate()->set_total(rtorrent->get_key("total_uploaded").as_value());
|
||||
|
||||
if (!rtorrent->has_key_value("ignore_ratio"))
|
||||
rtorrent->insert_key("ignore_ratio", (int64_t)0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ DownloadList::resume(Download* download) {
|
||||
// Set 'hashing' to started if hashing wasn't started, else keep
|
||||
// the old value.
|
||||
if (download->variable()->get_value("hashing") == Download::variable_hashing_stopped)
|
||||
download->variable()->set("hashing", Download::variable_hashing_initial);
|
||||
download->variable()->set("hashing", Download::variable_hashing_initial);
|
||||
|
||||
std::for_each(slot_map_hash_queued().begin(), slot_map_hash_queued().end(), download_list_call(download));
|
||||
return;
|
||||
@@ -401,11 +401,16 @@ DownloadList::hash_done(Download* download) {
|
||||
case Download::variable_hashing_rehash:
|
||||
// Normal re/hashing.
|
||||
|
||||
if (download->is_done())
|
||||
download->variable()->set("complete", (int64_t)1);
|
||||
|
||||
// If the download was previously completed but the files were
|
||||
// f.ex deleted, then we clear the state and complete.
|
||||
if (!download->variable()->get_value("complete") && download->is_done()) {
|
||||
download->variable()->set("state", (int64_t)0);
|
||||
download->set_message("Download registered as completed, but hash check returned unfinished chunks.");
|
||||
}
|
||||
|
||||
// Save resume data so we update time-stamps and priorities if
|
||||
// they were invalid/changed when loading.
|
||||
// they were invalid/changed while loading/hashing.
|
||||
download->variable()->set("complete", (int64_t)download->is_done());
|
||||
download->download()->hash_resume_save();
|
||||
|
||||
if (download->variable()->get_value("state") == 1)
|
||||
|
||||
Reference in New Issue
Block a user