mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-16 15:12:30 +00:00
* Renamed all commands to from e.g "get_d_*" to "d.get_*". Remember to
update your rc file. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@953 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -173,27 +173,27 @@ DownloadFactory::receive_success() {
|
||||
initialize_rtorrent(download, rtorrent);
|
||||
|
||||
// Move to 'rtorrent'.
|
||||
rpc::call_command_d("set_d_connection_leech", download, m_variables["connection_leech"]);
|
||||
rpc::call_command_d("set_d_connection_seed", download, m_variables["connection_seed"]);
|
||||
rpc::call_command_d("d.set_connection_leech", download, m_variables["connection_leech"]);
|
||||
rpc::call_command_d("d.set_connection_seed", download, m_variables["connection_seed"]);
|
||||
|
||||
rpc::call_command_d("set_d_max_uploads", download, rpc::call_command_void("get_max_uploads"));
|
||||
rpc::call_command_d("set_d_min_peers", download, rpc::call_command_void("get_min_peers"));
|
||||
rpc::call_command_d("set_d_max_peers", download, rpc::call_command_void("get_max_peers"));
|
||||
rpc::call_command_d("set_d_tracker_numwant", download, rpc::call_command_void("get_tracker_numwant"));
|
||||
rpc::call_command_d("d.set_max_uploads", download, rpc::call_command_void("get_max_uploads"));
|
||||
rpc::call_command_d("d.set_min_peers", download, rpc::call_command_void("get_min_peers"));
|
||||
rpc::call_command_d("d.set_max_peers", download, rpc::call_command_void("get_max_peers"));
|
||||
rpc::call_command_d("d.set_tracker_numwant", download, rpc::call_command_void("get_tracker_numwant"));
|
||||
|
||||
if (rpc::call_command_d_value("get_d_complete", download) != 0) {
|
||||
if (rpc::call_command_d_value("d.get_complete", download) != 0) {
|
||||
if (rpc::call_command_value("get_min_peers_seed") >= 0)
|
||||
rpc::call_command_d("set_d_min_peers", download, rpc::call_command_void("get_min_peers_seed"));
|
||||
rpc::call_command_d("d.set_min_peers", download, rpc::call_command_void("get_min_peers_seed"));
|
||||
|
||||
if (rpc::call_command_value("get_max_peers_seed") >= 0)
|
||||
rpc::call_command_d("set_d_max_peers", download, rpc::call_command_void("get_max_peers_seed"));
|
||||
rpc::call_command_d("d.set_max_peers", download, rpc::call_command_void("get_max_peers_seed"));
|
||||
}
|
||||
|
||||
if (!rpc::call_command_value("get_use_udp_trackers"))
|
||||
download->enable_udp_trackers(false);
|
||||
|
||||
if (rpc::call_command_value("get_max_file_size") > 0)
|
||||
rpc::call_command_d("set_d_max_file_size", download, rpc::call_command_void("get_max_file_size"));
|
||||
rpc::call_command_d("d.set_max_file_size", download, rpc::call_command_void("get_max_file_size"));
|
||||
|
||||
// Check first if we already have these values set in the session
|
||||
// torrent, so that it is safe to change the values.
|
||||
@@ -205,12 +205,12 @@ DownloadFactory::receive_success() {
|
||||
rpc::call_command_string("split_suffix"));
|
||||
|
||||
if (!rtorrent->has_key_string("directory"))
|
||||
rpc::call_command_d("set_d_directory", download, m_variables["directory"]);
|
||||
rpc::call_command_d("d.set_directory", download, m_variables["directory"]);
|
||||
else
|
||||
rpc::call_command_d("set_d_directory", download, rtorrent->get_key("directory"));
|
||||
rpc::call_command_d("d.set_directory", download, rtorrent->get_key("directory"));
|
||||
|
||||
if (!m_session && m_variables["tied_to_file"].as_value())
|
||||
rpc::call_command_d("set_d_tied_to_file", download, m_uri);
|
||||
rpc::call_command_d("d.set_tied_to_file", download, m_uri);
|
||||
|
||||
torrent::Object& resumeObject = root->has_key_map("libtorrent_resume")
|
||||
? root->get_key("libtorrent_resume")
|
||||
@@ -262,8 +262,8 @@ DownloadFactory::receive_success() {
|
||||
if (m_session) {
|
||||
// This torrent was queued for hashing or hashing when the session
|
||||
// file was saved. Or it was in a started state.
|
||||
if (rpc::call_command_d_value("get_d_hashing", download) != Download::variable_hashing_stopped ||
|
||||
rpc::call_command_d_value("get_d_state", download) != 0)
|
||||
if (rpc::call_command_d_value("d.get_hashing", download) != Download::variable_hashing_stopped ||
|
||||
rpc::call_command_d_value("d.get_state", download) != 0)
|
||||
m_manager->download_list()->resume(download);
|
||||
|
||||
} else {
|
||||
@@ -312,9 +312,9 @@ DownloadFactory::initialize_rtorrent(Download* download, torrent::Object* rtorre
|
||||
rtorrent->insert_key("tied_to_file", std::string());
|
||||
|
||||
if (rtorrent->has_key_value("priority"))
|
||||
rpc::call_command_d("set_d_priority", download, rtorrent->get_key_value("priority") % 4);
|
||||
rpc::call_command_d("d.set_priority", download, rtorrent->get_key_value("priority") % 4);
|
||||
else
|
||||
rpc::call_command_d("set_d_priority", download, (int64_t)2);
|
||||
rpc::call_command_d("d.set_priority", download, (int64_t)2);
|
||||
|
||||
if (rtorrent->has_key_value("key")) {
|
||||
download->tracker_list()->set_key(rtorrent->get_key_value("key"));
|
||||
|
||||
+31
-31
@@ -269,7 +269,7 @@ DownloadList::close_throw(Download* download) {
|
||||
|
||||
download->download()->close();
|
||||
|
||||
if (!download->is_hash_failed() && rpc::call_command_d_value("get_d_hashing", download) != Download::variable_hashing_stopped)
|
||||
if (!download->is_hash_failed() && rpc::call_command_d_value("d.get_hashing", download) != Download::variable_hashing_stopped)
|
||||
throw torrent::internal_error("DownloadList::close_throw(...) called but we're going into a hashing loop.");
|
||||
|
||||
std::for_each(slot_map_hash_removed().begin(), slot_map_hash_removed().end(), download_list_call(download));
|
||||
@@ -283,7 +283,7 @@ DownloadList::start_normal(Download* download) {
|
||||
// Clear hash failed as we're doing a manual start and want to try
|
||||
// hashing again.
|
||||
download->set_hash_failed(false);
|
||||
rpc::call_command_d("set_d_state", download, (int64_t)1);
|
||||
rpc::call_command_d("d.set_state", download, (int64_t)1);
|
||||
|
||||
resume(download);
|
||||
}
|
||||
@@ -295,12 +295,12 @@ DownloadList::start_try(Download* download) {
|
||||
// Also don't start if the state is one of those that indicate we
|
||||
// were manually stopped?
|
||||
|
||||
if (download->is_hash_failed() || rpc::call_command_d_value("get_d_ignore_commands", download) != 0)
|
||||
if (download->is_hash_failed() || rpc::call_command_d_value("d.get_ignore_commands", download) != 0)
|
||||
return false;
|
||||
|
||||
// Don't clear the hash failed as this function is used by scripts,
|
||||
// etc.
|
||||
rpc::call_command_d("set_d_state", download, (int64_t)1);
|
||||
rpc::call_command_d("d.set_state", download, (int64_t)1);
|
||||
|
||||
resume(download);
|
||||
return true;
|
||||
@@ -310,7 +310,7 @@ void
|
||||
DownloadList::stop_normal(Download* download) {
|
||||
check_contains(download);
|
||||
|
||||
rpc::call_command_d("set_d_state", download, (int64_t)0);
|
||||
rpc::call_command_d("d.set_state", download, (int64_t)0);
|
||||
|
||||
pause(download);
|
||||
}
|
||||
@@ -319,10 +319,10 @@ bool
|
||||
DownloadList::stop_try(Download* download) {
|
||||
check_contains(download);
|
||||
|
||||
if (rpc::call_command_d_value("get_d_ignore_commands", download) != 0)
|
||||
if (rpc::call_command_d_value("d.get_ignore_commands", download) != 0)
|
||||
return false;
|
||||
|
||||
rpc::call_command_d("set_d_state", download, (int64_t)0);
|
||||
rpc::call_command_d("d.set_state", download, (int64_t)0);
|
||||
|
||||
pause(download);
|
||||
return true;
|
||||
@@ -348,8 +348,8 @@ DownloadList::resume(Download* download) {
|
||||
if (download->is_hash_failed())
|
||||
return;
|
||||
|
||||
if (rpc::call_command_d_value("get_d_hashing", download) == Download::variable_hashing_stopped)
|
||||
rpc::call_command_d("set_d_hashing", download, Download::variable_hashing_initial);
|
||||
if (rpc::call_command_d_value("d.get_hashing", download) == Download::variable_hashing_stopped)
|
||||
rpc::call_command_d("d.set_hashing", download, Download::variable_hashing_initial);
|
||||
|
||||
std::for_each(slot_map_hash_queued().begin(), slot_map_hash_queued().end(), download_list_call(download));
|
||||
return;
|
||||
@@ -358,12 +358,12 @@ DownloadList::resume(Download* download) {
|
||||
// This will never actually do anything due to the above hash check.
|
||||
// open_throw(download);
|
||||
|
||||
rpc::call_command_d("set_d_state_changed", download, cachedTime.seconds());
|
||||
rpc::call_command_d("d.set_state_changed", download, cachedTime.seconds());
|
||||
|
||||
if (download->is_done()) {
|
||||
rpc::call_command_d("set_d_connection_current", download, rpc::call_command_d_void("get_d_connection_seed", download));
|
||||
rpc::call_command_d("d.set_connection_current", download, rpc::call_command_d_void("d.get_connection_seed", download));
|
||||
} else {
|
||||
rpc::call_command_d("set_d_connection_current", download, rpc::call_command_d_void("get_d_connection_leech", download));
|
||||
rpc::call_command_d("d.set_connection_current", download, rpc::call_command_d_void("d.get_connection_leech", download));
|
||||
|
||||
// For the moment, clear the resume data so we force hash-check
|
||||
// on non-complete downloads after a crash. This shouldn't be
|
||||
@@ -392,9 +392,9 @@ DownloadList::pause(Download* download) {
|
||||
|
||||
// Always clear hashing on pause. When a hashing request is added,
|
||||
// it should have cleared the hash resume data.
|
||||
if (rpc::call_command_d_value("get_d_hashing", download) != Download::variable_hashing_stopped) {
|
||||
if (rpc::call_command_d_value("d.get_hashing", download) != Download::variable_hashing_stopped) {
|
||||
download->download()->hash_stop();
|
||||
rpc::call_command_d_set_value("set_d_hashing", download, Download::variable_hashing_stopped);
|
||||
rpc::call_command_d_set_value("d.set_hashing", download, Download::variable_hashing_stopped);
|
||||
|
||||
std::for_each(slot_map_hash_removed().begin(), slot_map_hash_removed().end(), download_list_call(download));
|
||||
}
|
||||
@@ -407,7 +407,7 @@ DownloadList::pause(Download* download) {
|
||||
|
||||
std::for_each(slot_map_stop().begin(), slot_map_stop().end(), download_list_call(download));
|
||||
|
||||
rpc::call_command_d("set_d_state_changed", download, cachedTime.seconds());
|
||||
rpc::call_command_d("d.set_state_changed", download, cachedTime.seconds());
|
||||
|
||||
// Save the state after all the slots, etc have been called so we
|
||||
// include the modifications they may make.
|
||||
@@ -424,7 +424,7 @@ DownloadList::check_hash(Download* download) {
|
||||
|
||||
try {
|
||||
|
||||
if (rpc::call_command_d_value("get_d_hashing", download) != Download::variable_hashing_stopped)
|
||||
if (rpc::call_command_d_value("d.get_hashing", download) != Download::variable_hashing_stopped)
|
||||
return;
|
||||
|
||||
hash_queue(download, Download::variable_hashing_rehash);
|
||||
@@ -457,8 +457,8 @@ DownloadList::hash_done(Download* download) {
|
||||
// confirm all the data, avoiding large BW usage on f.ex. the
|
||||
// ReiserFS bug with >4GB files.
|
||||
|
||||
int64_t hashing = rpc::call_command_d_value("get_d_hashing", download);
|
||||
rpc::call_command_d_set_value("set_d_hashing", download, Download::variable_hashing_stopped);
|
||||
int64_t hashing = rpc::call_command_d_value("d.get_hashing", download);
|
||||
rpc::call_command_d_set_value("d.set_hashing", download, Download::variable_hashing_stopped);
|
||||
|
||||
switch (hashing) {
|
||||
case Download::variable_hashing_initial:
|
||||
@@ -467,17 +467,17 @@ DownloadList::hash_done(Download* download) {
|
||||
|
||||
// If the download was previously completed but the files were
|
||||
// f.ex deleted, then we clear the state and complete.
|
||||
if (rpc::call_command_d_value("get_d_complete", download) && !download->is_done()) {
|
||||
rpc::call_command_d("set_d_state", download, (int64_t)0);
|
||||
if (rpc::call_command_d_value("d.get_complete", download) && !download->is_done()) {
|
||||
rpc::call_command_d("d.set_state", download, (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 while loading/hashing.
|
||||
rpc::call_command_d("set_d_complete", download, (int64_t)download->is_done());
|
||||
rpc::call_command_d("d.set_complete", download, (int64_t)download->is_done());
|
||||
torrent::resume_save_progress(*download->download(), download->download()->bencode()->get_key("libtorrent_resume"));
|
||||
|
||||
if (rpc::call_command_d_value("get_d_state", download) == 1)
|
||||
if (rpc::call_command_d_value("d.get_state", download) == 1)
|
||||
resume(download);
|
||||
|
||||
break;
|
||||
@@ -507,14 +507,14 @@ void
|
||||
DownloadList::hash_queue(Download* download, int type) {
|
||||
check_contains(download);
|
||||
|
||||
if (rpc::call_command_d_value("get_d_hashing", download) != Download::variable_hashing_stopped)
|
||||
if (rpc::call_command_d_value("d.get_hashing", download) != Download::variable_hashing_stopped)
|
||||
throw torrent::internal_error("DownloadList::hash_queue(...) hashing already queued.");
|
||||
|
||||
close_throw(download);
|
||||
torrent::resume_clear_progress(*download->download(), download->download()->bencode()->get_key("libtorrent_resume"));
|
||||
|
||||
download->set_hash_failed(false);
|
||||
rpc::call_command_d_set_value("set_d_hashing", download, type);
|
||||
rpc::call_command_d_set_value("d.set_hashing", download, type);
|
||||
|
||||
if (download->is_open())
|
||||
throw torrent::internal_error("DownloadList::hash_clear(...) download still open.");
|
||||
@@ -543,16 +543,16 @@ void
|
||||
DownloadList::confirm_finished(Download* download) {
|
||||
check_contains(download);
|
||||
|
||||
rpc::call_command_d("set_d_complete", download, (int64_t)1);
|
||||
rpc::call_command_d("d.set_complete", download, (int64_t)1);
|
||||
|
||||
rpc::call_command_d("set_d_connection_current", download, rpc::call_command_d_void("get_d_connection_seed", download));
|
||||
rpc::call_command_d("d.set_connection_current", download, rpc::call_command_d_void("d.get_connection_seed", download));
|
||||
download->set_priority(download->priority());
|
||||
|
||||
if (rpc::call_command_d_value("get_d_min_peers", download) == rpc::call_command_value("get_min_peers") && rpc::call_command_value("get_min_peers_seed") >= 0)
|
||||
rpc::call_command_d("set_d_min_peers", download, rpc::call_command_void("get_min_peers_seed"));
|
||||
if (rpc::call_command_d_value("d.get_min_peers", download) == rpc::call_command_value("get_min_peers") && rpc::call_command_value("get_min_peers_seed") >= 0)
|
||||
rpc::call_command_d("d.set_min_peers", download, rpc::call_command_void("get_min_peers_seed"));
|
||||
|
||||
if (rpc::call_command_d_value("get_d_max_peers", download) == rpc::call_command_value("get_max_peers") && rpc::call_command_value("get_max_peers_seed") >= 0)
|
||||
rpc::call_command_d("set_d_max_peers", download, rpc::call_command_void("get_max_peers_seed"));
|
||||
if (rpc::call_command_d_value("d.get_max_peers", download) == rpc::call_command_value("get_max_peers") && rpc::call_command_value("get_max_peers_seed") >= 0)
|
||||
rpc::call_command_d("d.set_max_peers", download, rpc::call_command_void("get_max_peers_seed"));
|
||||
|
||||
// Do this before the slots are called in case one of them closes
|
||||
// the download.
|
||||
@@ -570,7 +570,7 @@ DownloadList::confirm_finished(Download* download) {
|
||||
close_throw(download);
|
||||
std::for_each(slot_map_finished().begin(), slot_map_finished().end(), download_list_call(download));
|
||||
|
||||
if (!download->is_active() && rpc::call_command_d_value("get_d_state", download) == 1)
|
||||
if (!download->is_active() && rpc::call_command_d_value("d.get_state", download) == 1)
|
||||
resume(download);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -230,7 +230,7 @@ Manager::initialize_second() {
|
||||
m_downloadList->slot_map_insert()["1_connect_storage_log"] = sigc::bind(sigc::ptr_fun(&connect_signal_storage_log), sigc::mem_fun(m_logComplete, &Log::push_front));
|
||||
m_downloadList->slot_map_insert()["1_connect_tracker_dump"] = sigc::bind(sigc::ptr_fun(&connect_signal_tracker_dump), sigc::ptr_fun(&receive_tracker_dump));
|
||||
|
||||
m_downloadList->slot_map_erase()["9_delete_tied"] = sigc::bind<0>(&rpc::call_command_d_v_void, "d_delete_tied");
|
||||
m_downloadList->slot_map_erase()["9_delete_tied"] = sigc::bind<0>(&rpc::call_command_d_v_void, "d.delete_tied");
|
||||
|
||||
torrent::connection_manager()->set_signal_handshake_log(sigc::mem_fun(this, &Manager::handshake_log));
|
||||
}
|
||||
@@ -460,7 +460,7 @@ path_expand(std::vector<std::string>* paths, const std::string& pattern) {
|
||||
|
||||
bool
|
||||
manager_equal_tied(const std::string& path, Download* download) {
|
||||
return path == rpc::call_command_d_string("get_d_tied_to_file", download);
|
||||
return path == rpc::call_command_d_string("d.get_tied_to_file", download);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -504,7 +504,7 @@ Manager::receive_hashing_changed() {
|
||||
continue;
|
||||
|
||||
bool tryQuick =
|
||||
rpc::call_command_d_value("get_d_hashing", *itr) == Download::variable_hashing_initial &&
|
||||
rpc::call_command_d_value("d.get_hashing", *itr) == Download::variable_hashing_initial &&
|
||||
(*itr)->download()->file_list()->bitfield()->empty();
|
||||
|
||||
if (!tryQuick && foundHashing)
|
||||
@@ -527,7 +527,7 @@ Manager::receive_hashing_changed() {
|
||||
(*itr)->download()->hash_stop();
|
||||
|
||||
if (foundHashing) {
|
||||
rpc::call_command_d_set_value("set_d_hashing", *itr, Download::variable_hashing_rehash);
|
||||
rpc::call_command_d_set_value("d.set_hashing", *itr, Download::variable_hashing_rehash);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -538,7 +538,7 @@ Manager::receive_hashing_changed() {
|
||||
} catch (torrent::local_error& e) {
|
||||
if (tryQuick) {
|
||||
// Make sure we don't repeat the quick hashing.
|
||||
rpc::call_command_d_set_value("set_d_hashing", *itr, Download::variable_hashing_rehash);
|
||||
rpc::call_command_d_set_value("d.set_hashing", *itr, Download::variable_hashing_rehash);
|
||||
|
||||
} else {
|
||||
(*itr)->set_hash_failed(true);
|
||||
|
||||
+11
-11
@@ -136,19 +136,19 @@ ViewManager::ViewManager(DownloadList* dl) :
|
||||
m_sort["name"] = new ViewSortName();
|
||||
m_sort["name_reverse"] = new ViewSortReverse(new ViewSortName());
|
||||
|
||||
m_sort["stopped"] = new ViewSortVariableValue("get_d_state");
|
||||
m_sort["started"] = new ViewSortVariableValue("get_d_state", true);
|
||||
m_sort["complete"] = new ViewSortVariableValue("get_d_complete");
|
||||
m_sort["incomplete"] = new ViewSortVariableValue("get_d_complete", true);
|
||||
m_sort["stopped"] = new ViewSortVariableValue("d.get_state");
|
||||
m_sort["started"] = new ViewSortVariableValue("d.get_state", true);
|
||||
m_sort["complete"] = new ViewSortVariableValue("d.get_complete");
|
||||
m_sort["incomplete"] = new ViewSortVariableValue("d.get_complete", true);
|
||||
|
||||
m_sort["state_changed"] = new ViewSortVariableValue("get_d_state_changed");
|
||||
m_sort["state_changed_reverse"] = new ViewSortVariableValue("get_d_state_changed", true);
|
||||
m_sort["state_changed"] = new ViewSortVariableValue("d.get_state_changed");
|
||||
m_sort["state_changed_reverse"] = new ViewSortVariableValue("d.get_state_changed", true);
|
||||
|
||||
m_filter["started"] = new ViewFilterVariableValue("get_d_state", 1);
|
||||
m_filter["stopped"] = new ViewFilterVariableValue("get_d_state", 0);
|
||||
m_filter["complete"] = new ViewFilterVariableValue("get_d_complete", 0, true);
|
||||
m_filter["incomplete"] = new ViewFilterVariableValue("get_d_complete", 0);
|
||||
m_filter["hashing"] = new ViewFilterVariableValue("get_d_hashing", 0, true);
|
||||
m_filter["started"] = new ViewFilterVariableValue("d.get_state", 1);
|
||||
m_filter["stopped"] = new ViewFilterVariableValue("d.get_state", 0);
|
||||
m_filter["complete"] = new ViewFilterVariableValue("d.get_complete", 0, true);
|
||||
m_filter["incomplete"] = new ViewFilterVariableValue("d.get_complete", 0);
|
||||
m_filter["hashing"] = new ViewFilterVariableValue("d.get_hashing", 0, true);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user