mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-17 23:52:30 +00:00
* Starting work on merging get/set variable. Moved the bool and value
variables, still might have missed some prior uses that might cause exceptions to be thrown. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@890 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -176,32 +176,32 @@ DownloadFactory::receive_success() {
|
||||
download->set("connection_leech", m_variables.get("connection_leech"));
|
||||
download->set("connection_seed", m_variables.get("connection_seed"));
|
||||
|
||||
download->set("max_uploads", control->variable()->get("max_uploads"));
|
||||
download->set("min_peers", control->variable()->get("min_peers"));
|
||||
download->set("max_peers", control->variable()->get("max_peers"));
|
||||
download->set("tracker_numwant", control->variable()->get("tracker_numwant"));
|
||||
download->set("max_uploads", control->variable()->get("get_max_uploads"));
|
||||
download->set("min_peers", control->variable()->get("get_min_peers"));
|
||||
download->set("max_peers", control->variable()->get("get_max_peers"));
|
||||
download->set("tracker_numwant", control->variable()->get("get_tracker_numwant"));
|
||||
|
||||
if (download->get_value("complete") != 0) {
|
||||
if (control->variable()->get_value("min_peers_seed") >= 0)
|
||||
download->set("min_peers", control->variable()->get("min_peers_seed"));
|
||||
if (control->variable()->get_value("get_min_peers_seed") >= 0)
|
||||
download->set("min_peers", control->variable()->get("get_min_peers_seed"));
|
||||
|
||||
if (control->variable()->get_value("max_peers_seed") >= 0)
|
||||
download->set("max_peers", control->variable()->get("max_peers_seed"));
|
||||
if (control->variable()->get_value("get_max_peers_seed") >= 0)
|
||||
download->set("max_peers", control->variable()->get("get_max_peers_seed"));
|
||||
}
|
||||
|
||||
if (!control->variable()->get_value("use_udp_trackers"))
|
||||
if (!control->variable()->get_value("get_use_udp_trackers"))
|
||||
download->enable_udp_trackers(false);
|
||||
|
||||
if (control->variable()->get_value("max_file_size") > 0)
|
||||
download->set("max_file_size", control->variable()->get("max_file_size"));
|
||||
if (control->variable()->get_value("get_max_file_size") > 0)
|
||||
download->set("max_file_size", control->variable()->get("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.
|
||||
//
|
||||
// Need to also catch the exceptions.
|
||||
if (control->variable()->get_value("split_file_size") >= 0)
|
||||
if (control->variable()->get_value("get_split_file_size") >= 0)
|
||||
torrent::file_split_all(download->download()->file_list(),
|
||||
control->variable()->get_value("split_file_size"),
|
||||
control->variable()->get_value("get_split_file_size"),
|
||||
control->variable()->get_string("split_suffix"));
|
||||
|
||||
if (!rtorrent->has_key_string("directory"))
|
||||
|
||||
@@ -501,7 +501,7 @@ void
|
||||
DownloadList::received_finished(Download* download) {
|
||||
check_contains(download);
|
||||
|
||||
if (control->variable()->get_value("check_hash")) {
|
||||
if (control->variable()->get_value("get_check_hash")) {
|
||||
// Set some 'checking_finished_thingie' variable to make hash_done
|
||||
// trigger correctly, also so it can bork on missing data.
|
||||
hash_queue(download, Download::variable_hashing_last);
|
||||
@@ -521,15 +521,15 @@ DownloadList::confirm_finished(Download* download) {
|
||||
download->set_connection_type(download->get_string("connection_seed"));
|
||||
download->set_priority(download->priority());
|
||||
|
||||
if (download->get_value("min_peers") == control->variable()->get_value("min_peers") && control->variable()->get_value("min_peers_seed") >= 0)
|
||||
download->set("min_peers", control->variable()->get("min_peers_seed"));
|
||||
if (download->get_value("min_peers") == control->variable()->get_value("get_min_peers") && control->variable()->get_value("get_min_peers_seed") >= 0)
|
||||
download->set("min_peers", control->variable()->get("get_min_peers_seed"));
|
||||
|
||||
if (download->get_value("max_peers") == control->variable()->get_value("max_peers") && control->variable()->get_value("max_peers_seed") >= 0)
|
||||
download->set("max_peers", control->variable()->get("max_peers_seed"));
|
||||
if (download->get_value("max_peers") == control->variable()->get_value("get_max_peers") && control->variable()->get_value("get_max_peers_seed") >= 0)
|
||||
download->set("max_peers", control->variable()->get("get_max_peers_seed"));
|
||||
|
||||
// Do this before the slots are called in case one of them closes
|
||||
// the download.
|
||||
if (!download->is_active() && control->variable()->get_value("session_on_completion") != 0) {
|
||||
if (!download->is_active() && control->variable()->get_value("get_session_on_completion") != 0) {
|
||||
torrent::resume_save_progress(*download->download(), download->download()->bencode()->get_key("libtorrent_resume"));
|
||||
control->core()->download_store()->save(download);
|
||||
}
|
||||
|
||||
+3
-3
@@ -108,7 +108,7 @@ receive_tracker_dump(const std::string& url, const char* data, size_t size) {
|
||||
|
||||
void
|
||||
Manager::handshake_log(const sockaddr* sa, int msg, int err, const torrent::HashString* hash) {
|
||||
if (!control->variable()->get_value("handshake_log"))
|
||||
if (!control->variable()->get_value("get_handshake_log"))
|
||||
return;
|
||||
|
||||
std::string peer;
|
||||
@@ -276,13 +276,13 @@ Manager::shutdown(bool force) {
|
||||
|
||||
void
|
||||
Manager::listen_open() {
|
||||
if (!control->variable()->get_value("port_open"))
|
||||
if (!control->variable()->get_value("get_port_open"))
|
||||
return;
|
||||
|
||||
if (m_portFirst > m_portLast)
|
||||
throw torrent::input_error("Invalid port range for listening");
|
||||
|
||||
if (control->variable()->get_value("port_random")) {
|
||||
if (control->variable()->get_value("get_port_random")) {
|
||||
int boundary = m_portFirst + random() % (m_portLast - m_portFirst + 1);
|
||||
|
||||
if (torrent::connection_manager()->listen_open(boundary, m_portLast) ||
|
||||
|
||||
Reference in New Issue
Block a user