diff --git a/ChangeLog b/ChangeLog index e9efb3ada..6084d1a4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + * document deprecation of dynamic loading/unloading of torrents * include user-agent in tracker announces in anonymous_mode for private torrents * add support for IPv6 peers from udp trackers * correctly URL encode the IPv6 argument to trackers diff --git a/examples/client_test.cpp b/examples/client_test.cpp index 0b4cbe502..413388d57 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -641,20 +641,6 @@ void signal_handler(int signo) quit = true; } -void load_torrent(libtorrent::sha1_hash const& ih, std::vector& buf, libtorrent::error_code& ec) -{ - files_t::iterator i = hash_to_filename.find(ih); - if (i == hash_to_filename.end()) - { - // for magnet links and torrents downloaded via - // URL, the metadata is saved in the resume file - // TODO: pick up metadata from the resume file - ec.assign(boost::system::errc::no_such_file_or_directory, boost::system::generic_category()); - return; - } - load_file(i->second, buf, ec); -} - // if non-empty, a peer that will be added to all torrents std::string peer; @@ -1586,7 +1572,6 @@ int main(int argc, char* argv[]) } ses.set_ip_filter(loaded_ip_filter); - ses.set_load_function(&load_torrent); error_code ec; diff --git a/include/libtorrent/session_handle.hpp b/include/libtorrent/session_handle.hpp index c2c32d23e..f56773b2e 100644 --- a/include/libtorrent/session_handle.hpp +++ b/include/libtorrent/session_handle.hpp @@ -259,6 +259,9 @@ namespace libtorrent void resume(); bool is_paused() const; + // *the feature of dynamically loading/unloading torrents is deprecated + // and discouraged* + // // This function enables dynamic-loading-of-torrent-files_. When a // torrent is unloaded but needs to be availabe in memory, this function // is called **from within the libtorrent network thread**. From within diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 40f52f2b0..077c8a218 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -3791,6 +3791,7 @@ retry: else { t->resume(); + if (!t->should_check_files()) continue; t->start_checking(); --limit; } @@ -7127,7 +7128,9 @@ retry: TORRENT_ASSERT(is_single_thread()); int loaded_limit = m_settings.get_int(settings_pack::active_loaded_limit); - TORRENT_ASSERT(m_num_save_resume <= loaded_limit); + TORRENT_ASSERT(loaded_limit == 0 + || !m_user_load_torrent + || m_num_save_resume <= loaded_limit); // if (m_num_save_resume < loaded_limit) // TORRENT_ASSERT(m_save_resume_queue.empty()); diff --git a/src/settings_pack.cpp b/src/settings_pack.cpp index 8513d5132..8be2a279a 100644 --- a/src/settings_pack.cpp +++ b/src/settings_pack.cpp @@ -276,7 +276,7 @@ namespace libtorrent SET(active_tracker_limit, 1600, 0), SET(active_lsd_limit, 60, 0), SET(active_limit, 15, &session_impl::trigger_auto_manage), - SET_NOPREV(active_loaded_limit, 100, &session_impl::trigger_auto_manage), + SET_NOPREV(active_loaded_limit, 0, &session_impl::trigger_auto_manage), SET(auto_manage_interval, 30, 0), SET(seed_time_limit, 24 * 60 * 60, 0), SET(auto_scrape_interval, 1800, 0),