diff --git a/configure.ac b/configure.ac index b9aa8830..9ff7b544 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ -AC_INIT(rtorrent, 0.9.2, jaris@ifi.uio.no) +AC_INIT(rtorrent, 0.9.3, jaris@ifi.uio.no) -AC_DEFINE(API_VERSION, 6, api version) +AC_DEFINE(API_VERSION, 8, api version) AM_INIT_AUTOMAKE AM_CONFIG_HEADER(config.h) @@ -49,7 +49,7 @@ PKG_CHECK_MODULES(libcurl, libcurl >= 7.15.4, CXXFLAGS="$CXXFLAGS $libcurl_CFLAGS"; LIBS="$LIBS $libcurl_LIBS") -PKG_CHECK_MODULES(libtorrent, libtorrent >= 0.13.2, +PKG_CHECK_MODULES(libtorrent, libtorrent >= 0.13.3, CXXFLAGS="$CXXFLAGS $libtorrent_CFLAGS"; LIBS="$LIBS $libtorrent_LIBS") diff --git a/doc/Makefile.am b/doc/Makefile.am index fc85ac11..bc69f9bc 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,7 +1,2 @@ -#man_MANS = rtorrent.1 - EXTRA_DIST= \ - faq.xml \ - rtorrent.1 \ - rtorrent.1.xml \ rtorrent.rc diff --git a/doc/log_proc_vmmap.sh b/doc/log_proc_vmmap.sh old mode 100644 new mode 100755 diff --git a/doc/rtorrent.1 b/doc/old/rtorrent.1 similarity index 100% rename from doc/rtorrent.1 rename to doc/old/rtorrent.1 diff --git a/doc/rtorrent.1.xml b/doc/old/rtorrent.1.xml similarity index 100% rename from doc/rtorrent.1.xml rename to doc/old/rtorrent.1.xml diff --git a/doc/rtorrent.rc b/doc/rtorrent.rc index 963082b2..3680b85b 100644 --- a/doc/rtorrent.rc +++ b/doc/rtorrent.rc @@ -52,7 +52,7 @@ # fixed that causes lack of diskspace not to be properly reported. #check_hash = no -# Set whetever the client should try to connect to UDP trackers. +# Set whether the client should try to connect to UDP trackers. #use_udp_trackers = yes # Alternative calls to bind and ip that should handle dynamic ip's. @@ -82,21 +82,3 @@ # Enable peer exchange (for torrents not marked private) # # peer_exchange = yes - -# -# Do not modify the following parameters unless you know what you're doing. -# - -# Hash read-ahead controls how many MB to request the kernel to read -# ahead. If the value is too low the disk may not be fully utilized, -# while if too high the kernel might not be able to keep the read -# pages in memory thus end up trashing. -#hash_read_ahead = 10 - -# Interval between attempts to check the hash, in milliseconds. -#hash_interval = 100 - -# Number of attempts to check the hash while using the mincore status, -# before forcing. Overworked systems might need lower values to get a -# decent hash checking rate. -#hash_max_tries = 10 diff --git a/doc/rtorrent_fast_resume.pl b/doc/rtorrent_fast_resume.pl old mode 100644 new mode 100755 diff --git a/doc/torrent_data b/doc/torrent_data old mode 100644 new mode 100755 diff --git a/rak/priority_queue_default.h b/rak/priority_queue_default.h index f2d8902d..420f5386 100644 --- a/rak/priority_queue_default.h +++ b/rak/priority_queue_default.h @@ -37,12 +37,13 @@ #ifndef RAK_PRIORITY_QUEUE_DEFAULT_H #define RAK_PRIORITY_QUEUE_DEFAULT_H -#include #include #include #include #include +#include "torrent/exceptions.h" + namespace rak { class priority_item { @@ -52,7 +53,7 @@ public: priority_item() {} ~priority_item() { if (is_queued()) - throw std::logic_error("priority_item::~priority_item() called on a queued item."); + throw torrent::internal_error("priority_item::~priority_item() called on a queued item."); m_time = timer(); m_slot = slot_void(); @@ -101,16 +102,16 @@ priority_queue_perform(priority_queue_default* queue, timer t) { inline void priority_queue_insert(priority_queue_default* queue, priority_item* item, timer t) { if (t == timer()) - throw std::logic_error("priority_queue_insert(...) received a bad timer."); + throw torrent::internal_error("priority_queue_insert(...) received a bad timer."); if (!item->is_valid()) - throw std::logic_error("priority_queue_insert(...) called on an invalid item."); + throw torrent::internal_error("priority_queue_insert(...) called on an invalid item."); if (item->is_queued()) - throw std::logic_error("priority_queue_insert(...) called on an already queued item."); + throw torrent::internal_error("priority_queue_insert(...) called on an already queued item."); if (queue->find(item) != queue->end()) - throw std::logic_error("priority_queue_insert(...) item found in queue."); + throw torrent::internal_error("priority_queue_insert(...) item found in queue."); item->set_time(t); queue->push(item); @@ -124,16 +125,16 @@ priority_queue_erase(priority_queue_default* queue, priority_item* item) { // Check is_valid() after is_queued() so that it is safe to call // erase on untouched instances. if (!item->is_valid()) - throw std::logic_error("priority_queue_erase(...) called on an invalid item."); + throw torrent::internal_error("priority_queue_erase(...) called on an invalid item."); // Clear time before erasing to force it to the top. item->clear_time(); if (!queue->erase(item)) - throw std::logic_error("priority_queue_erase(...) could not find item in queue."); + throw torrent::internal_error("priority_queue_erase(...) could not find item in queue."); if (queue->find(item) != queue->end()) - throw std::logic_error("priority_queue_erase(...) item still in queue."); + throw torrent::internal_error("priority_queue_erase(...) item still in queue."); } } diff --git a/src/command_download.cc b/src/command_download.cc index 18db22c5..1e2cd4e2 100644 --- a/src/command_download.cc +++ b/src/command_download.cc @@ -138,9 +138,10 @@ apply_d_change_link(core::Download* download, const torrent::Object::list_type& switch (changeType) { case 0: - // if (symlink(target.c_str(), link.c_str()) == -1) - // control->core()->push_log("create_link failed: " + std::string(rak::error_number::current().c_str())); - // control->core()->push_log("create_link failed: " + std::string(rak::error_number::current().c_str()) + " to " + target); + if (symlink(target.c_str(), link.c_str()) == -1){ + lt_log_print(torrent::LOG_TORRENT_WARN, "create_link failed: %s", + rak::error_number::current().c_str()); + } break; case 1: @@ -149,8 +150,9 @@ apply_d_change_link(core::Download* download, const torrent::Object::list_type& rak::error_number::clear_global(); if (!fileStat.update_link(link) || !fileStat.is_link() || - unlink(link.c_str()) == -1) { - // control->core()->push_log("delete_link failed: " + std::string(rak::error_number::current().c_str())); + unlink(link.c_str()) == -1){ + lt_log_print(torrent::LOG_TORRENT_WARN, "delete_link failed: %s", + rak::error_number::current().c_str()); } break; } diff --git a/src/command_ip.cc b/src/command_ip.cc index 2b960184..13216f5f 100644 --- a/src/command_ip.cc +++ b/src/command_ip.cc @@ -245,9 +245,6 @@ append_table(torrent::ipv4_table::base_type* extent, torrent::Object::list_type& torrent::ipv4_table::table_type::iterator first = extent->table.begin(); torrent::ipv4_table::table_type::iterator last = extent->table.end(); - int current_value = 0; - uint32_t range_first = 0; - while (first != last) { if (first->first != NULL) { // Do something more here?... @@ -266,9 +263,6 @@ append_table(torrent::ipv4_table::base_type* extent, torrent::Object::list_type& torrent::option_as_string(torrent::OPTION_IP_FILTER, first->second)); result.push_back((std::string)buffer); - - range_first = position; - current_value = first->second; } first++; diff --git a/src/core/download_factory.cc b/src/core/download_factory.cc index dc9b64ef..0ac36ba2 100644 --- a/src/core/download_factory.cc +++ b/src/core/download_factory.cc @@ -110,11 +110,11 @@ DownloadFactory::DownloadFactory(Manager* m) : m_taskLoad.slot() = std::tr1::bind(&DownloadFactory::receive_load, this); m_taskCommit.slot() = std::tr1::bind(&DownloadFactory::receive_commit, this); - // m_variables["connection_leech"] = rpc::call_command_void("protocol.connection.leech"); - // m_variables["connection_seed"] = rpc::call_command_void("protocol.connection.seed"); + // m_variables["connection_leech"] = rpc::call_command("protocol.connection.leech"); + // m_variables["connection_seed"] = rpc::call_command("protocol.connection.seed"); m_variables["connection_leech"] = std::string(); m_variables["connection_seed"] = std::string(); - m_variables["directory"] = rpc::call_command_void("directory.default"); + m_variables["directory"] = rpc::call_command("directory.default"); m_variables["tied_to_file"] = torrent::Object((int64_t)false); } @@ -255,21 +255,21 @@ DownloadFactory::receive_success() { if (!rtorrent->has_key_string("custom4")) rtorrent->insert_key("custom4", std::string()); if (!rtorrent->has_key_string("custom5")) rtorrent->insert_key("custom5", std::string()); - rpc::call_command("d.uploads_min.set", rpc::call_command_void("throttle.min_uploads"), rpc::make_target(download)); - rpc::call_command("d.uploads_max.set", rpc::call_command_void("throttle.max_uploads"), rpc::make_target(download)); - rpc::call_command("d.downloads_min.set", rpc::call_command_void("throttle.min_downloads"), rpc::make_target(download)); - rpc::call_command("d.downloads_max.set", rpc::call_command_void("throttle.max_downloads"), rpc::make_target(download)); - rpc::call_command("d.peers_min.set", rpc::call_command_void("throttle.min_peers.normal"), rpc::make_target(download)); - rpc::call_command("d.peers_max.set", rpc::call_command_void("throttle.max_peers.normal"), rpc::make_target(download)); - rpc::call_command("d.tracker_numwant.set", rpc::call_command_void("trackers.numwant"), rpc::make_target(download)); - rpc::call_command("d.max_file_size.set", rpc::call_command_void("system.file.max_size"), rpc::make_target(download)); + rpc::call_command("d.uploads_min.set", rpc::call_command("throttle.min_uploads"), rpc::make_target(download)); + rpc::call_command("d.uploads_max.set", rpc::call_command("throttle.max_uploads"), rpc::make_target(download)); + rpc::call_command("d.downloads_min.set", rpc::call_command("throttle.min_downloads"), rpc::make_target(download)); + rpc::call_command("d.downloads_max.set", rpc::call_command("throttle.max_downloads"), rpc::make_target(download)); + rpc::call_command("d.peers_min.set", rpc::call_command("throttle.min_peers.normal"), rpc::make_target(download)); + rpc::call_command("d.peers_max.set", rpc::call_command("throttle.max_peers.normal"), rpc::make_target(download)); + rpc::call_command("d.tracker_numwant.set", rpc::call_command("trackers.numwant"), rpc::make_target(download)); + rpc::call_command("d.max_file_size.set", rpc::call_command("system.file.max_size"), rpc::make_target(download)); if (rpc::call_command_value("d.complete", rpc::make_target(download)) != 0) { if (rpc::call_command_value("throttle.min_peers.seed") >= 0) - rpc::call_command("d.peers_min.set", rpc::call_command_void("throttle.min_peers.seed"), rpc::make_target(download)); + rpc::call_command("d.peers_min.set", rpc::call_command("throttle.min_peers.seed"), rpc::make_target(download)); if (rpc::call_command_value("throttle.max_peers.seed") >= 0) - rpc::call_command("d.peers_max.set", rpc::call_command_void("throttle.max_peers.seed"), rpc::make_target(download)); + rpc::call_command("d.peers_max.set", rpc::call_command("throttle.max_peers.seed"), rpc::make_target(download)); } if (!rpc::call_command_value("trackers.use_udp")) diff --git a/src/core/download_list.cc b/src/core/download_list.cc index ebf4a6bf..7d7ea96a 100644 --- a/src/core/download_list.cc +++ b/src/core/download_list.cc @@ -373,26 +373,26 @@ DownloadList::resume(Download* download, int flags) { rpc::call_command("d.state_counter.set", rpc::call_command_value("d.state_counter", rpc::make_target(download)) + 1, rpc::make_target(download)); if (download->is_done()) { - torrent::Object conn_current = rpc::call_command_void("d.connection_seed", rpc::make_target(download)); - torrent::Object choke_up = rpc::call_command_void("d.up.choke_heuristics.seed", rpc::make_target(download)); - torrent::Object choke_down = rpc::call_command_void("d.down.choke_heuristics.seed", rpc::make_target(download)); + torrent::Object conn_current = rpc::call_command("d.connection_seed", torrent::Object(), rpc::make_target(download)); + torrent::Object choke_up = rpc::call_command("d.up.choke_heuristics.seed", torrent::Object(), rpc::make_target(download)); + torrent::Object choke_down = rpc::call_command("d.down.choke_heuristics.seed", torrent::Object(), rpc::make_target(download)); - if (conn_current.is_string_empty()) conn_current = rpc::call_command_void("protocol.connection.seed", rpc::make_target(download)); - if (choke_up.is_string_empty()) choke_up = rpc::call_command_void("protocol.choke_heuristics.up.seed", rpc::make_target(download)); - if (choke_down.is_string_empty()) choke_down = rpc::call_command_void("protocol.choke_heuristics.down.seed", rpc::make_target(download)); + if (conn_current.is_string_empty()) conn_current = rpc::call_command("protocol.connection.seed", torrent::Object(), rpc::make_target(download)); + if (choke_up.is_string_empty()) choke_up = rpc::call_command("protocol.choke_heuristics.up.seed", torrent::Object(), rpc::make_target(download)); + if (choke_down.is_string_empty()) choke_down = rpc::call_command("protocol.choke_heuristics.down.seed", torrent::Object(), rpc::make_target(download)); rpc::call_command("d.connection_current.set", conn_current, rpc::make_target(download)); rpc::call_command("d.up.choke_heuristics.set", choke_up, rpc::make_target(download)); rpc::call_command("d.down.choke_heuristics.set", choke_down, rpc::make_target(download)); } else { - torrent::Object conn_current = rpc::call_command_void("d.connection_leech", rpc::make_target(download)); - torrent::Object choke_up = rpc::call_command_void("d.up.choke_heuristics.leech", rpc::make_target(download)); - torrent::Object choke_down = rpc::call_command_void("d.down.choke_heuristics.leech", rpc::make_target(download)); + torrent::Object conn_current = rpc::call_command("d.connection_leech", torrent::Object(), rpc::make_target(download)); + torrent::Object choke_up = rpc::call_command("d.up.choke_heuristics.leech", torrent::Object(), rpc::make_target(download)); + torrent::Object choke_down = rpc::call_command("d.down.choke_heuristics.leech", torrent::Object(), rpc::make_target(download)); - if (conn_current.is_string_empty()) conn_current = rpc::call_command_void("protocol.connection.leech", rpc::make_target(download)); - if (choke_up.is_string_empty()) choke_up = rpc::call_command_void("protocol.choke_heuristics.up.leech", rpc::make_target(download)); - if (choke_down.is_string_empty()) choke_down = rpc::call_command_void("protocol.choke_heuristics.down.leech", rpc::make_target(download)); + if (conn_current.is_string_empty()) conn_current = rpc::call_command("protocol.connection.leech", torrent::Object(), rpc::make_target(download)); + if (choke_up.is_string_empty()) choke_up = rpc::call_command("protocol.choke_heuristics.up.leech", torrent::Object(), rpc::make_target(download)); + if (choke_down.is_string_empty()) choke_down = rpc::call_command("protocol.choke_heuristics.down.leech", torrent::Object(), rpc::make_target(download)); rpc::call_command("d.connection_current.set", conn_current, rpc::make_target(download)); rpc::call_command("d.up.choke_heuristics.set", choke_up, rpc::make_target(download)); @@ -462,8 +462,8 @@ DownloadList::pause(Download* download, int flags) { // If initial seeding is complete, don't try it again when restarting. if (download->is_done() && - rpc::call_command_void("d.connection_current", rpc::make_target(download)).as_string() == "initial_seed") - rpc::call_command("d.connection_seed.set", rpc::call_command_void("d.connection_current", rpc::make_target(download)), rpc::make_target(download)); + rpc::call_command("d.connection_current", torrent::Object(), rpc::make_target(download)).as_string() == "initial_seed") + rpc::call_command("d.connection_seed.set", rpc::call_command("d.connection_current", torrent::Object(), rpc::make_target(download)), rpc::make_target(download)); // Save the state after all the slots, etc have been called so we // include the modifications they may make. @@ -625,13 +625,13 @@ DownloadList::confirm_finished(Download* download) { rpc::call_command("d.complete.set", (int64_t)1, rpc::make_target(download)); // Clean up these settings: - torrent::Object conn_current = rpc::call_command_void("d.connection_seed", rpc::make_target(download)); - torrent::Object choke_up = rpc::call_command_void("d.up.choke_heuristics.seed", rpc::make_target(download)); - torrent::Object choke_down = rpc::call_command_void("d.down.choke_heuristics.seed", rpc::make_target(download)); + torrent::Object conn_current = rpc::call_command("d.connection_seed", torrent::Object(), rpc::make_target(download)); + torrent::Object choke_up = rpc::call_command("d.up.choke_heuristics.seed", torrent::Object(), rpc::make_target(download)); + torrent::Object choke_down = rpc::call_command("d.down.choke_heuristics.seed", torrent::Object(), rpc::make_target(download)); - if (conn_current.is_string_empty()) conn_current = rpc::call_command_void("protocol.connection.seed", rpc::make_target(download)); - if (choke_up.is_string_empty()) choke_up = rpc::call_command_void("protocol.choke_heuristics.up.seed", rpc::make_target(download)); - if (choke_down.is_string_empty()) choke_down = rpc::call_command_void("protocol.choke_heuristics.down.seed", rpc::make_target(download)); + if (conn_current.is_string_empty()) conn_current = rpc::call_command("protocol.connection.seed", torrent::Object(), rpc::make_target(download)); + if (choke_up.is_string_empty()) choke_up = rpc::call_command("protocol.choke_heuristics.up.seed", torrent::Object(), rpc::make_target(download)); + if (choke_down.is_string_empty()) choke_down = rpc::call_command("protocol.choke_heuristics.down.seed", torrent::Object(), rpc::make_target(download)); rpc::call_command("d.connection_current.set", conn_current, rpc::make_target(download)); rpc::call_command("d.up.choke_heuristics.set", choke_up, rpc::make_target(download)); @@ -641,11 +641,11 @@ DownloadList::confirm_finished(Download* download) { if (rpc::call_command_value("d.peers_min", rpc::make_target(download)) == rpc::call_command_value("throttle.min_peers.normal") && rpc::call_command_value("throttle.min_peers.seed") >= 0) - rpc::call_command("d.peers_min.set", rpc::call_command_void("throttle.min_peers.seed"), rpc::make_target(download)); + rpc::call_command("d.peers_min.set", rpc::call_command("throttle.min_peers.seed"), rpc::make_target(download)); if (rpc::call_command_value("d.peers_max", rpc::make_target(download)) == rpc::call_command_value("throttle.max_peers.normal") && rpc::call_command_value("throttle.max_peers.seed") >= 0) - rpc::call_command("d.peers_max.set", rpc::call_command_void("throttle.max_peers.seed"), rpc::make_target(download)); + rpc::call_command("d.peers_max.set", rpc::call_command("throttle.max_peers.seed"), rpc::make_target(download)); // Do this before the slots are called in case one of them closes // the download. diff --git a/src/core/manager.cc b/src/core/manager.cc index d27ec91e..63b53443 100644 --- a/src/core/manager.cc +++ b/src/core/manager.cc @@ -185,7 +185,7 @@ Manager::listen_open() { return; int portFirst, portLast; - torrent::Object portRange = rpc::call_command_void("network.port_range"); + torrent::Object portRange = rpc::call_command("network.port_range"); if (portRange.is_string()) { if (std::sscanf(portRange.as_string().c_str(), "%i-%i", &portFirst, &portLast) != 2) diff --git a/src/globals.cc b/src/globals.cc index a73230ef..4bbf4129 100644 --- a/src/globals.cc +++ b/src/globals.cc @@ -43,4 +43,4 @@ rak::timer cachedTime; rpc::ip_table_list ip_tables; Control* control = NULL; -ThreadWorker* worker_thread = NULL; +ThreadWorker* worker_thread = NULL; diff --git a/src/main.cc b/src/main.cc index 4f2a9184..843037f6 100644 --- a/src/main.cc +++ b/src/main.cc @@ -239,15 +239,6 @@ main(int argc, char** argv) { rpc::parse_command_multiple (rpc::make_target(), -// "method.insert = test.value,value\n" -// "method.insert = test.value2,value,6\n" - -// "method.insert = test.string,string,6\n" -// "method.insert = test.bool,bool,true\n" - - // "method.insert.simple = test.method.simple,((print,simple_test_,$argument.0=))\n" - // "method.insert.simple = test.method.double,((print,simple_test_,$argument.0=)),\"print=simple_test_,$argument.1=\"\n" - "method.insert = event.download.inserted,multi|rlookup|static\n" "method.insert = event.download.inserted_new,multi|rlookup|static\n" "method.insert = event.download.inserted_session,multi|rlookup|static\n" @@ -895,8 +886,6 @@ handle_sigbus(int signum, siginfo_t* sa, void* ptr) { SignalHandler::set_default(signum); display::Canvas::cleanup(); - // Use printf here instead... - std::stringstream output; output << "Caught SIGBUS, dumping stack:" << std::endl; @@ -913,7 +902,6 @@ handle_sigbus(int signum, siginfo_t* sa, void* ptr) { #else output << "Stack dump not enabled." << std::endl; #endif - output << std::endl << "Error: " << rak::error_number(sa->si_errno).c_str() << std::endl; const char* signal_reason; @@ -1039,7 +1027,7 @@ print_help() { std::cout << " o View trackers" << std::endl; std::cout << std::endl; - std::cout << "Report bugs to ." << std::endl; + std::cout << "Report bugs to ." << std::endl; exit(0); } diff --git a/src/rpc/parse_commands.h b/src/rpc/parse_commands.h index 2df33723..2fa5434d 100644 --- a/src/rpc/parse_commands.h +++ b/src/rpc/parse_commands.h @@ -95,19 +95,13 @@ parse_command_multiple_d_nothrow(core::Download* download, const std::string& cm } } -inline torrent::Object call_command (const char* key, const torrent::Object& obj, target_type target = make_target()) { return commands.call_command(key, obj, target); } -inline torrent::Object call_command_void (const char* key, target_type target = make_target()) { return commands.call_command(key, torrent::Object(), target); } +inline torrent::Object call_command (const char* key, const torrent::Object& obj = torrent::Object(), target_type target = make_target()) { return commands.call_command(key, obj, target); } inline std::string call_command_string(const char* key, target_type target = make_target()) { return commands.call_command(key, torrent::Object(), target).as_string(); } inline int64_t call_command_value (const char* key, target_type target = make_target()) { return commands.call_command(key, torrent::Object(), target).as_value(); } inline void call_command_set_string(const char* key, const std::string& arg) { commands.call_command(key, torrent::Object(arg)); } inline void call_command_set_std_string(const std::string& key, const std::string& arg) { commands.call_command(key.c_str(), torrent::Object(arg)); } - -inline void call_command_d_v_void(const char* key, core::Download* download) { commands.call_command_d(key, download, torrent::Object()); } - -inline void call_command_set_value(const char* key, int64_t arg, target_type target = make_target()) { commands.call_command(key, torrent::Object(arg), target); } -inline void call_command_d_set_string(const char* key, core::Download* download, const std::string& arg) { commands.call_command_d(key, download, torrent::Object(arg)); } -inline void call_command_d_set_std_string(const std::string& key, core::Download* download, const std::string& arg) { commands.call_command_d(key.c_str(), download, torrent::Object(arg)); } +inline void call_command_set_value(const char* key, int64_t arg, target_type target = make_target()) { commands.call_command(key, torrent::Object(arg), target); } inline torrent::Object call_command_d_range(const char* key, core::Download* download, torrent::Object::list_const_iterator first, torrent::Object::list_const_iterator last) {