mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-08 15:19:20 +00:00
* Added 'close_untied' option.
* Remove redundant BitField::update calls now that updating Bitfield::m_set gets handled properly in hash_resume_load. * Fixed the error message when trying to lock non-existant session directories. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@687 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+19
-6
@@ -130,21 +130,32 @@ Change view.
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>^s</term>
|
||||
<term>^S</term>
|
||||
<listitem><para>
|
||||
Start download.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>^d</term>
|
||||
<term>^D</term>
|
||||
<listitem><para>
|
||||
Stop an active download, or remove a stopped download.
|
||||
|
||||
Stop an active download, or remove a stopped download.
|
||||
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>^r</term>
|
||||
<term>^K</term>
|
||||
<listitem><para>
|
||||
|
||||
Close a torrent and its files.
|
||||
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>^R</term>
|
||||
<listitem><para>
|
||||
Initiate hash check of torrent.
|
||||
</para></listitem>
|
||||
@@ -553,11 +564,13 @@ Delete <emphasis>id</emphasis> from the scheduler.
|
||||
|
||||
<varlistentry>
|
||||
<term>stop_untied =</term>
|
||||
<term>close_untied =</term>
|
||||
<term>remove_untied =</term>
|
||||
<listitem><para>
|
||||
|
||||
Stop or remove the torrents that are tied to filenames that have been
|
||||
deleted, the association is then cleared.
|
||||
Stop, close or remove the torrents that are tied to filenames that
|
||||
have been deleted, the association with the file is then cleared so
|
||||
the event will not trigger more than once.
|
||||
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -49,6 +49,10 @@ public:
|
||||
static const int e_connreset = ECONNRESET;
|
||||
static const int e_connaborted = ECONNABORTED;
|
||||
static const int e_deadlk = EDEADLK;
|
||||
|
||||
static const int e_noent = ENOENT;
|
||||
static const int e_notdir = ENOTDIR;
|
||||
|
||||
static const int e_intr = EINTR;
|
||||
|
||||
error_number() : m_errno(0) {}
|
||||
@@ -64,6 +68,8 @@ public:
|
||||
|
||||
bool is_closed() const { return m_errno == e_connreset || m_errno == e_connaborted; }
|
||||
|
||||
bool is_bad_path() const { return m_errno == e_noent || m_errno == e_notdir || m_errno == e_access; }
|
||||
|
||||
static error_number current() { return errno; }
|
||||
static void clear_global() { errno = 0; }
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <rak/error_number.h>
|
||||
#include <rak/path.h>
|
||||
#include <rak/string_manip.h>
|
||||
#include <torrent/object.h>
|
||||
@@ -68,7 +69,10 @@ DownloadStore::enable(bool lock) {
|
||||
m_lockfile.set_path(std::string());
|
||||
|
||||
if (!m_lockfile.try_lock())
|
||||
throw torrent::input_error("Could not lock session directory: \"" + m_path + "\", held by \"" + m_lockfile.locked_by_as_string() + "\".");
|
||||
if (rak::error_number::current().is_bad_path())
|
||||
throw torrent::input_error("Could not lock session directory: \"" + m_path + "\", " + rak::error_number::current().c_str());
|
||||
else
|
||||
throw torrent::input_error("Could not lock session directory: \"" + m_path + "\", held by \"" + m_lockfile.locked_by_as_string() + "\".");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -146,7 +146,7 @@ ViewManager::ViewManager(DownloadList* dl) :
|
||||
|
||||
m_filter["started"] = new ViewFilterVariableValue("state", 1);
|
||||
m_filter["stopped"] = new ViewFilterVariableValue("state", 0);
|
||||
m_filter["complete"] = new ViewFilterVariableValue("complete", 0, false);
|
||||
m_filter["complete"] = new ViewFilterVariableValue("complete", 0, true);
|
||||
m_filter["incomplete"] = new ViewFilterVariableValue("complete", 0);
|
||||
m_filter["hashing"] = new ViewFilterVariableValue("hashing", 0, true);
|
||||
}
|
||||
|
||||
@@ -116,6 +116,25 @@ apply_stop_untied(Control* m) {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
apply_close_untied(Control* m) {
|
||||
core::Manager::DListItr itr = m->core()->download_list()->begin();
|
||||
|
||||
while ((itr = std::find_if(itr, m->core()->download_list()->end(),
|
||||
rak::on(rak::bind2nd(std::mem_fun(&core::Download::variable_string), "tied_to_file"),
|
||||
std::not1(std::mem_fun_ref(&std::string::empty)))))
|
||||
!= m->core()->download_list()->end()) {
|
||||
rak::file_stat fs;
|
||||
|
||||
if (!fs.update(rak::path_expand((*itr)->variable_string("tied_to_file")))) {
|
||||
(*itr)->variable()->set("tied_to_file", std::string());
|
||||
m->core()->download_list()->close(*itr);
|
||||
}
|
||||
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
apply_remove_untied(Control* m) {
|
||||
core::Manager::DListItr itr = m->core()->download_list()->begin();
|
||||
@@ -386,6 +405,7 @@ initialize_option_handler(Control* c) {
|
||||
variables->insert("load", new utils::VariableStringSlot(rak::value_fn(std::string()), rak::bind_ptr_fn(&apply_load, c)));
|
||||
variables->insert("load_start", new utils::VariableStringSlot(rak::value_fn(std::string()), rak::bind_ptr_fn(&apply_load_start, c)));
|
||||
variables->insert("stop_untied", new utils::VariableVoidSlot(rak::bind_ptr_fn(&apply_stop_untied, c)));
|
||||
variables->insert("close_untied", new utils::VariableVoidSlot(rak::bind_ptr_fn(&apply_close_untied, c)));
|
||||
variables->insert("remove_untied", new utils::VariableVoidSlot(rak::bind_ptr_fn(&apply_remove_untied, c)));
|
||||
|
||||
variables->insert("enable_trackers", new utils::VariableStringSlot(rak::value_fn(std::string()), rak::bind_ptr_fn(&apply_enable_trackers, c)));
|
||||
|
||||
Reference in New Issue
Block a user