From 652fd25c074df3df0455f1d413b8cc5387da3365 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Fri, 21 Jul 2006 20:19:55 +0000 Subject: [PATCH] * Detect the amount of address space available for mapping chunks and use that to decide when syncing is needed. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@745 e378c898-3ddf-0310-93e7-cc216c733640 --- src/core/download.cc | 4 ---- src/core/download_factory.cc | 12 ------------ src/display/window_peer_info.cc | 1 + src/option_handler_rules.cc | 9 ++++++--- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/core/download.cc b/src/core/download.cc index cc5b8cd1..b881d421 100644 --- a/src/core/download.cc +++ b/src/core/download.cc @@ -94,10 +94,6 @@ Download::Download(download_type d) : m_variables.insert("min_peers", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::peers_min), rak::mem_fn(&m_download, &download_type::set_peers_min))); m_variables.insert("max_peers", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::peers_max), rak::mem_fn(&m_download, &download_type::set_peers_max))); m_variables.insert("max_uploads", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::uploads_max), rak::mem_fn(&m_download, &download_type::set_uploads_max))); - m_variables.insert("max_chunks_queued", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::max_chunks_queued), rak::mem_fn(&m_download, &download_type::set_max_chunks_queued))); - - m_variables.insert("timeout_sync", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::timeout_sync), rak::mem_fn(&m_download, &download_type::set_timeout_sync))); - m_variables.insert("timeout_safe_sync", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::timeout_safe_sync), rak::mem_fn(&m_download, &download_type::set_timeout_safe_sync))); m_variables.insert("priority", new utils::VariableValueSlot(rak::mem_fn(this, &Download::priority), rak::mem_fn(this, &Download::set_priority))); diff --git a/src/core/download_factory.cc b/src/core/download_factory.cc index c5bbf17f..b1a640b9 100644 --- a/src/core/download_factory.cc +++ b/src/core/download_factory.cc @@ -176,18 +176,6 @@ DownloadFactory::receive_success() { download->variable()->set("max_peers", control->variable()->get("max_peers")); download->variable()->set("max_uploads", control->variable()->get("max_uploads")); - if (!control->variable()->get_value("timeout_sync") != 0) - download->variable()->set("timeout_sync", control->variable()->get("timeout_sync")); - - if (!control->variable()->get_value("timeout_safe_sync") != 0) - download->variable()->set("timeout_safe_sync", control->variable()->get("timeout_safe_sync")); - - if (!control->variable()->get_value("max_chunks_queued") != 0) - download->variable()->set("max_chunks_queued", control->variable()->get("max_chunks_queued")); - else - // Temporary until we fix the library. - download->variable()->set("max_chunks_queued", (512 << 20) / download->download()->chunks_size()); - if (!control->variable()->get_value("use_udp_trackers")) download->enable_udp_trackers(false); diff --git a/src/display/window_peer_info.cc b/src/display/window_peer_info.cc index e5c31e7c..4702c1e0 100644 --- a/src/display/window_peer_info.cc +++ b/src/display/window_peer_info.cc @@ -104,6 +104,7 @@ WindowPeerInfo::redraw() { m_canvas->print(0, y++, "Max Memory Usage: %llu MB", torrent::chunk_manager()->max_memory_usage() / (1 << 20)); m_canvas->print(0, y++, "Free Diskspace: %llu MB", m_download->download()->free_diskspace() / (1 << 20)); + m_canvas->print(0, y++, "Safe Diskspace: %llu MB", torrent::chunk_manager()->safe_free_diskspace() / (1 << 20)); y++; diff --git a/src/option_handler_rules.cc b/src/option_handler_rules.cc index 6994b467..eb7118f0 100644 --- a/src/option_handler_rules.cc +++ b/src/option_handler_rules.cc @@ -428,9 +428,6 @@ initialize_option_handler(Control* c) { variables->insert("max_uploads", new utils::VariableValue(15)); variables->insert("max_chunks_queued", new utils::VariableValue(0)); - variables->insert("timeout_sync", new utils::VariableValue(0)); - variables->insert("timeout_safe_sync", new utils::VariableValue(0)); - variables->insert("download_rate", new utils::VariableValueSlot(rak::ptr_fn(&torrent::down_throttle), rak::mem_fn(control->ui(), &ui::Root::set_down_throttle_i64), 0, (1 << 10))); variables->insert("upload_rate", new utils::VariableValueSlot(rak::ptr_fn(&torrent::up_throttle), rak::mem_fn(control->ui(), &ui::Root::set_up_throttle_i64), @@ -469,6 +466,12 @@ initialize_option_handler(Control* c) { variables->insert("max_memory_usage", new utils::VariableValueSlot(rak::mem_fn(torrent::chunk_manager(), &torrent::ChunkManager::max_memory_usage), rak::mem_fn(torrent::chunk_manager(), &torrent::ChunkManager::set_max_memory_usage))); + variables->insert("timeout_sync", new utils::VariableValueSlot(rak::mem_fn(torrent::chunk_manager(), &torrent::ChunkManager::timeout_sync), + rak::mem_fn(torrent::chunk_manager(), &torrent::ChunkManager::set_timeout_sync))); + + variables->insert("timeout_safe_sync", new utils::VariableValueSlot(rak::mem_fn(torrent::chunk_manager(), &torrent::ChunkManager::timeout_safe_sync), + rak::mem_fn(torrent::chunk_manager(), &torrent::ChunkManager::set_timeout_safe_sync))); + variables->insert("port_range", new utils::VariableStringSlot(rak::value_fn(std::string()), rak::bind_ptr_fn(&apply_port_range, c))); variables->insert("hash_read_ahead", new utils::VariableValueSlot(rak::ptr_fn(torrent::hash_read_ahead), rak::bind_ptr_fn(&apply_hash_read_ahead, c)));