mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-13 13:42:30 +00:00
* Proper fault handling for bad SCGI requests.
* Cleaned up duplicate code in 'xmlrpc.cc'. * Cleaned up 'parse_commands.h'. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@966 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+11
-11
@@ -105,7 +105,7 @@ apply_stop_on_ratio(const torrent::Object& rawArgs) {
|
||||
if ((totalUpload >= minUpload && totalUpload * 100 >= totalDone * minRatio) ||
|
||||
(maxRatio > 0 && totalUpload * 100 > totalDone * maxRatio)) {
|
||||
downloadList->stop_try(*itr);
|
||||
rpc::call_command_d("d.set_ignore_commands", *itr, (int64_t)1);
|
||||
rpc::call_command("d.set_ignore_commands", (int64_t)1, rpc::make_target(*itr));
|
||||
}
|
||||
|
||||
++itr;
|
||||
@@ -117,14 +117,14 @@ apply_stop_on_ratio(const torrent::Object& rawArgs) {
|
||||
torrent::Object
|
||||
apply_start_tied() {
|
||||
for (core::DownloadList::iterator itr = control->core()->download_list()->begin(); itr != control->core()->download_list()->end(); ++itr) {
|
||||
if (rpc::call_command_d_value("d.get_state", *itr) == 1)
|
||||
if (rpc::call_command_value("d.get_state", rpc::make_target(*itr)) == 1)
|
||||
continue;
|
||||
|
||||
rak::file_stat fs;
|
||||
const std::string& tiedToFile = rpc::call_command_d_string("d.get_tied_to_file", *itr);
|
||||
const std::string& tiedToFile = rpc::call_command_string("d.get_tied_to_file", rpc::make_target(*itr));
|
||||
|
||||
if (!tiedToFile.empty() && fs.update(rak::path_expand(tiedToFile)))
|
||||
control->core()->download_list()->start_try(*itr);
|
||||
control->core()->download_list()->start_normal(*itr);
|
||||
}
|
||||
|
||||
return torrent::Object();
|
||||
@@ -133,14 +133,14 @@ apply_start_tied() {
|
||||
torrent::Object
|
||||
apply_stop_untied() {
|
||||
for (core::DownloadList::iterator itr = control->core()->download_list()->begin(); itr != control->core()->download_list()->end(); ++itr) {
|
||||
if (rpc::call_command_d_value("d.get_state", *itr) == 0)
|
||||
if (rpc::call_command_value("d.get_state", rpc::make_target(*itr)) == 0)
|
||||
continue;
|
||||
|
||||
rak::file_stat fs;
|
||||
const std::string& tiedToFile = rpc::call_command_d_string("d.get_tied_to_file", *itr);
|
||||
const std::string& tiedToFile = rpc::call_command_string("d.get_tied_to_file", rpc::make_target(*itr));
|
||||
|
||||
if (!tiedToFile.empty() && !fs.update(rak::path_expand(tiedToFile)))
|
||||
control->core()->download_list()->stop_try(*itr);
|
||||
control->core()->download_list()->stop_normal(*itr);
|
||||
}
|
||||
|
||||
return torrent::Object();
|
||||
@@ -150,9 +150,9 @@ torrent::Object
|
||||
apply_close_untied() {
|
||||
for (core::DownloadList::iterator itr = control->core()->download_list()->begin(); itr != control->core()->download_list()->end(); ++itr) {
|
||||
rak::file_stat fs;
|
||||
const std::string& tiedToFile = rpc::call_command_d_string("d.get_tied_to_file", *itr);
|
||||
const std::string& tiedToFile = rpc::call_command_string("d.get_tied_to_file", rpc::make_target(*itr));
|
||||
|
||||
if (!tiedToFile.empty() && !fs.update(rak::path_expand(tiedToFile)) && control->core()->download_list()->stop_try(*itr))
|
||||
if (!tiedToFile.empty() && !fs.update(rak::path_expand(tiedToFile)))
|
||||
control->core()->download_list()->close(*itr);
|
||||
}
|
||||
|
||||
@@ -163,11 +163,11 @@ torrent::Object
|
||||
apply_remove_untied() {
|
||||
for (core::DownloadList::iterator itr = control->core()->download_list()->begin(); itr != control->core()->download_list()->end(); ) {
|
||||
rak::file_stat fs;
|
||||
const std::string& tiedToFile = rpc::call_command_d_string("d.get_tied_to_file", *itr);
|
||||
const std::string& tiedToFile = rpc::call_command_string("d.get_tied_to_file", rpc::make_target(*itr));
|
||||
|
||||
if (!tiedToFile.empty() && !fs.update(rak::path_expand(tiedToFile))) {
|
||||
// Need to clear tied_to_file so it doesn't try to delete it.
|
||||
rpc::call_command_d("d.set_tied_to_file", *itr, std::string());
|
||||
rpc::call_command("d.set_tied_to_file", std::string(), rpc::make_target(*itr));
|
||||
|
||||
itr = control->core()->download_list()->erase(itr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user