mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-12 21:22:31 +00:00
Merge branch 'master' into xirvik
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -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"))
|
||||
|
||||
+22
-22
@@ -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.
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
+1
-1
@@ -43,4 +43,4 @@ rak::timer cachedTime;
|
||||
rpc::ip_table_list ip_tables;
|
||||
|
||||
Control* control = NULL;
|
||||
ThreadWorker* worker_thread = NULL;
|
||||
ThreadWorker* worker_thread = NULL;
|
||||
|
||||
+1
-13
@@ -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 <jaris@ifi.uio.no>." << std::endl;
|
||||
std::cout << "Report bugs to <sundell.software@gmail.com>." << std::endl;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user