diff --git a/ChangeLog b/ChangeLog index ac9e663e0..6b16c897b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + * fix issue related to unloading torrents * fixed finished-time calculation * add missing min_memory_usage() and high_performance_seed() settings presets to python * fix stat cache issue that sometimes would produce incorrect resume data diff --git a/include/libtorrent/add_torrent_params.hpp b/include/libtorrent/add_torrent_params.hpp index a52ad0e9e..db39bbabf 100644 --- a/include/libtorrent/add_torrent_params.hpp +++ b/include/libtorrent/add_torrent_params.hpp @@ -311,6 +311,9 @@ namespace libtorrent // On windows this path (and other paths) are interpreted as UNC // paths. This means they must use backslashes as directory separators // and may not contain the special directories "." or "..". + // + // Setting this to an absolute path is slightly more performant than a + // relative path. std::string save_path; // The optional parameter, ``resume_data`` can be given if up to date diff --git a/src/file_storage.cpp b/src/file_storage.cpp index d904da436..9f1248cbc 100644 --- a/src/file_storage.cpp +++ b/src/file_storage.cpp @@ -850,7 +850,7 @@ namespace libtorrent if (index >= int(m_file_hashes.size())) return sha1_hash(0); return sha1_hash(m_file_hashes[index]); } - + std::string const& file_storage::symlink(internal_file_entry const& fe) const { TORRENT_ASSERT_PRECOND(fe.symlink_index < int(m_symlinks.size())); diff --git a/src/session_handle.cpp b/src/session_handle.cpp index b3ab55c78..0930ab732 100644 --- a/src/session_handle.cpp +++ b/src/session_handle.cpp @@ -172,6 +172,7 @@ namespace libtorrent void session_handle::async_add_torrent(add_torrent_params const& params) { add_torrent_params* p = new add_torrent_params(params); + p->save_path = complete(p->save_path); #ifndef TORRENT_NO_DEPRECATE if (params.tracker_url) { diff --git a/src/session_impl.cpp b/src/session_impl.cpp index c1543974e..f7a7112b6 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -4794,6 +4794,8 @@ retry: { params->url.clear(); params->ti = boost::shared_ptr(j->buffer.torrent_file); + TORRENT_ASSERT(params->ti->is_valid()); + TORRENT_ASSERT(params->ti->num_files() > 0); handle = add_torrent(*params, ec); } diff --git a/src/torrent.cpp b/src/torrent.cpp index 1c7f92f19..36382e1bc 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -7163,6 +7163,7 @@ namespace libtorrent } m_verified.resize(m_torrent_file->num_pieces(), false); + m_verifying.resize(m_torrent_file->num_pieces(), false); } } @@ -8301,6 +8302,8 @@ namespace libtorrent // returns true if this torrent is interested in connecting to more peers bool torrent::want_peers() const { + if (m_should_be_loaded == false) return false; + // if all our connection slots are taken, we can't connect to more if (m_connections.size() >= m_max_connections) return false; @@ -10236,6 +10239,8 @@ namespace libtorrent TORRENT_ASSERT(is_single_thread()); INVARIANT_CHECK; + if (m_should_be_loaded == false) return; + boost::weak_ptr self(shared_from_this()); #ifndef TORRENT_DISABLE_EXTENSIONS @@ -11383,6 +11388,12 @@ namespace libtorrent TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(want_peers()); + if (m_should_be_loaded == false) + { + update_want_peers(); + return false; + } + torrent_state st = get_peer_list_state(); need_peer_list(); torrent_peer* p = m_peer_list->connect_one_peer(m_ses.session_time(), &st);