fix issue with unloading torrents (#1624)

fix issue with unloading torrents
This commit is contained in:
Arvid Norberg 2017-01-25 23:42:59 -05:00 committed by GitHub
parent b19cb7bd87
commit ba9fae8e1f
6 changed files with 19 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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()));

View File

@ -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)
{

View File

@ -4794,6 +4794,8 @@ retry:
{
params->url.clear();
params->ti = boost::shared_ptr<torrent_info>(j->buffer.torrent_file);
TORRENT_ASSERT(params->ti->is_valid());
TORRENT_ASSERT(params->ti->num_files() > 0);
handle = add_torrent(*params, ec);
}

View File

@ -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<torrent> 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);