From 0c393e1cdbdc6c98910cc935cacb6e9eae5fc38b Mon Sep 17 00:00:00 2001 From: rakshasa Date: Sat, 4 Nov 2006 16:05:28 +0000 Subject: [PATCH] * Properly nul-terminate the info hash and client id in the tracker request. * Implemented options for read-ahead of chunks. 'preload_min_pipelined', 'preload_min_size' and 'preload_required_rate' are used to decide when to read-ahead a chunk. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@800 e378c898-3ddf-0310-93e7-cc216c733640 --- rak/error_number.h | 2 ++ src/option_handler_rules.cc | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/rak/error_number.h b/rak/error_number.h index 400c7989..11402bd9 100644 --- a/rak/error_number.h +++ b/rak/error_number.h @@ -53,6 +53,7 @@ public: static const int e_noent = ENOENT; static const int e_nomem = ENOMEM; static const int e_notdir = ENOTDIR; + static const int e_isdir = EISDIR; static const int e_intr = EINTR; @@ -73,6 +74,7 @@ public: static error_number current() { return errno; } static void clear_global() { errno = 0; } + static void set_global(error_number err) { errno = err.m_errno; } bool operator == (const error_number& e) const { return m_errno == e.m_errno; } diff --git a/src/option_handler_rules.cc b/src/option_handler_rules.cc index f91ff5f9..dfa84521 100644 --- a/src/option_handler_rules.cc +++ b/src/option_handler_rules.cc @@ -514,6 +514,15 @@ initialize_option_handler(Control* c) { 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("preload_min_pipelined", new utils::VariableValueSlot(rak::mem_fn(torrent::chunk_manager(), &torrent::ChunkManager::preload_min_pipelined), + rak::mem_fn(torrent::chunk_manager(), &torrent::ChunkManager::set_preload_min_pipelined))); + + variables->insert("preload_min_size", new utils::VariableValueSlot(rak::mem_fn(torrent::chunk_manager(), &torrent::ChunkManager::preload_min_size), + rak::mem_fn(torrent::chunk_manager(), &torrent::ChunkManager::set_preload_min_size))); + + variables->insert("preload_required_rate", new utils::VariableValueSlot(rak::mem_fn(torrent::chunk_manager(), &torrent::ChunkManager::preload_required_rate), + rak::mem_fn(torrent::chunk_manager(), &torrent::ChunkManager::set_preload_required_rate))); + 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)));