mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-14 22:22:31 +00:00
* Finished refactoring command_network.cc.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1152 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -108,8 +108,8 @@ DownloadFactory::DownloadFactory(Manager* m) :
|
||||
m_taskLoad.set_slot(rak::mem_fn(this, &DownloadFactory::receive_load));
|
||||
m_taskCommit.set_slot(rak::mem_fn(this, &DownloadFactory::receive_commit));
|
||||
|
||||
m_variables["connection_leech"] = rpc::call_command_void("get_connection_leech");
|
||||
m_variables["connection_seed"] = rpc::call_command_void("get_connection_seed");
|
||||
m_variables["connection_leech"] = rpc::call_command_void("connection_leech");
|
||||
m_variables["connection_seed"] = rpc::call_command_void("connection_seed");
|
||||
m_variables["directory"] = rpc::call_command_void("get_directory");
|
||||
m_variables["tied_to_file"] = torrent::Object((int64_t)false);
|
||||
}
|
||||
@@ -251,20 +251,20 @@ 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.set_uploads_max", rpc::call_command_void("get_max_uploads"), rpc::make_target(download));
|
||||
rpc::call_command("d.set_peers_min", rpc::call_command_void("get_min_peers"), rpc::make_target(download));
|
||||
rpc::call_command("d.set_peers_max", rpc::call_command_void("get_max_peers"), rpc::make_target(download));
|
||||
rpc::call_command("d.set_tracker_numwant", rpc::call_command_void("get_tracker_numwant"), rpc::make_target(download));
|
||||
rpc::call_command("d.set_uploads_max", rpc::call_command_void("max_uploads"), rpc::make_target(download));
|
||||
rpc::call_command("d.set_peers_min", rpc::call_command_void("min_peers"), rpc::make_target(download));
|
||||
rpc::call_command("d.set_peers_max", rpc::call_command_void("max_peers"), rpc::make_target(download));
|
||||
rpc::call_command("d.set_tracker_numwant", rpc::call_command_void("trackers.numwant"), rpc::make_target(download));
|
||||
|
||||
if (rpc::call_command_value("d.get_complete", rpc::make_target(download)) != 0) {
|
||||
if (rpc::call_command_value("get_min_peers_seed") >= 0)
|
||||
rpc::call_command("d.set_peers_min", rpc::call_command_void("get_min_peers_seed"), rpc::make_target(download));
|
||||
if (rpc::call_command_value("min_peers_seed") >= 0)
|
||||
rpc::call_command("d.set_peers_min", rpc::call_command_void("min_peers_seed"), rpc::make_target(download));
|
||||
|
||||
if (rpc::call_command_value("get_max_peers_seed") >= 0)
|
||||
rpc::call_command("d.set_peers_max", rpc::call_command_void("get_max_peers_seed"), rpc::make_target(download));
|
||||
if (rpc::call_command_value("max_peers_seed") >= 0)
|
||||
rpc::call_command("d.set_peers_max", rpc::call_command_void("max_peers_seed"), rpc::make_target(download));
|
||||
}
|
||||
|
||||
if (!rpc::call_command_value("get_use_udp_trackers"))
|
||||
if (!rpc::call_command_value("trackers.use_udp"))
|
||||
download->enable_udp_trackers(false);
|
||||
|
||||
if (rpc::call_command_value("system.file.max_size") > 0)
|
||||
@@ -287,7 +287,7 @@ DownloadFactory::receive_success() {
|
||||
if (!m_session && m_variables["tied_to_file"].as_value())
|
||||
rpc::call_command("d.set_tied_to_file", m_uri.empty() ? m_variables["tied_file"] : m_uri, rpc::make_target(download));
|
||||
|
||||
rpc::call_command("d.peer_exchange.set", rpc::call_command_value("get_peer_exchange"), rpc::make_target(download));
|
||||
rpc::call_command("d.peer_exchange.set", rpc::call_command_value("protocol.pex"), rpc::make_target(download));
|
||||
|
||||
torrent::resume_load_addresses(*download->download(), resumeObject);
|
||||
torrent::resume_load_file_priorities(*download->download(), resumeObject);
|
||||
|
||||
@@ -579,11 +579,11 @@ DownloadList::confirm_finished(Download* download) {
|
||||
rpc::call_command("d.set_connection_current", rpc::call_command_void("d.get_connection_seed", rpc::make_target(download)), rpc::make_target(download));
|
||||
download->set_priority(download->priority());
|
||||
|
||||
if (rpc::call_command_value("d.get_peers_min", rpc::make_target(download)) == rpc::call_command_value("get_min_peers") && rpc::call_command_value("get_min_peers_seed") >= 0)
|
||||
rpc::call_command("d.set_peers_min", rpc::call_command_void("get_min_peers_seed"), rpc::make_target(download));
|
||||
if (rpc::call_command_value("d.get_peers_min", rpc::make_target(download)) == rpc::call_command_value("min_peers") && rpc::call_command_value("min_peers_seed") >= 0)
|
||||
rpc::call_command("d.set_peers_min", rpc::call_command_void("min_peers_seed"), rpc::make_target(download));
|
||||
|
||||
if (rpc::call_command_value("d.get_peers_max", rpc::make_target(download)) == rpc::call_command_value("get_max_peers") && rpc::call_command_value("get_max_peers_seed") >= 0)
|
||||
rpc::call_command("d.set_peers_max", rpc::call_command_void("get_max_peers_seed"), rpc::make_target(download));
|
||||
if (rpc::call_command_value("d.get_peers_max", rpc::make_target(download)) == rpc::call_command_value("max_peers") && rpc::call_command_value("max_peers_seed") >= 0)
|
||||
rpc::call_command("d.set_peers_max", rpc::call_command_void("max_peers_seed"), rpc::make_target(download));
|
||||
|
||||
// Do this before the slots are called in case one of them closes
|
||||
// the download.
|
||||
|
||||
+3
-3
@@ -257,11 +257,11 @@ void
|
||||
Manager::listen_open() {
|
||||
// This stuff really should be moved outside of manager, make it
|
||||
// part of the init script.
|
||||
if (!rpc::call_command_value("get_port_open"))
|
||||
if (!rpc::call_command_value("port_open"))
|
||||
return;
|
||||
|
||||
int portFirst, portLast;
|
||||
torrent::Object portRange = rpc::call_command_void("get_port_range");
|
||||
torrent::Object portRange = rpc::call_command_void("port_range");
|
||||
|
||||
if (portRange.is_string()) {
|
||||
if (std::sscanf(portRange.as_string().c_str(), "%i-%i", &portFirst, &portLast) != 2)
|
||||
@@ -276,7 +276,7 @@ Manager::listen_open() {
|
||||
if (portFirst > portLast || portLast >= (1 << 16))
|
||||
throw torrent::input_error("Invalid port range.");
|
||||
|
||||
if (rpc::call_command_value("get_port_random")) {
|
||||
if (rpc::call_command_value("port_random")) {
|
||||
int boundary = portFirst + random() % (portLast - portFirst + 1);
|
||||
|
||||
if (torrent::connection_manager()->listen_open(boundary, portLast) ||
|
||||
|
||||
Reference in New Issue
Block a user