fix invalid assert for resume data being loaded

This commit is contained in:
Arvid Norberg
2011-06-09 05:46:47 +00:00
parent 887423ef1e
commit 67ad61fd0a
2 changed files with 20 additions and 16 deletions

View File

@@ -3507,9 +3507,9 @@ namespace aux {
if (t->state() == torrent_status::checking_files if (t->state() == torrent_status::checking_files
|| t->state() == torrent_status::queued_for_checking) || t->state() == torrent_status::queued_for_checking)
continue; continue;
TORRENT_ASSERT(t->m_resume_data_loaded);
if (t->is_auto_managed() && !t->has_error()) if (t->is_auto_managed() && !t->has_error())
{ {
TORRENT_ASSERT(t->m_resume_data_loaded || !t->valid_metadata());
// this torrent is auto managed, add it to // this torrent is auto managed, add it to
// the list (depending on if it's a seed or not) // the list (depending on if it's a seed or not)
if (t->is_finished()) if (t->is_finished())
@@ -3519,6 +3519,7 @@ namespace aux {
} }
else if (!t->is_paused()) else if (!t->is_paused())
{ {
TORRENT_ASSERT(t->m_resume_data_loaded || !t->valid_metadata());
--hard_limit; --hard_limit;
if (is_active(t, settings())) if (is_active(t, settings()))
{ {

View File

@@ -628,22 +628,22 @@ namespace libtorrent
session_impl::torrent_map::iterator i = m_ses.m_torrents.find(m_torrent_file->info_hash()); session_impl::torrent_map::iterator i = m_ses.m_torrents.find(m_torrent_file->info_hash());
if (i != m_ses.m_torrents.end()) if (i != m_ses.m_torrents.end())
{ {
if (!m_uuid.empty() && i->second->uuid().empty()) if (!m_uuid.empty() && i->second->uuid().empty())
i->second->set_uuid(m_uuid); i->second->set_uuid(m_uuid);
if (!m_url.empty() && i->second->url().empty()) if (!m_url.empty() && i->second->url().empty())
i->second->set_url(m_url); i->second->set_url(m_url);
if (!m_source_feed_url.empty() && i->second->source_feed_url().empty()) if (!m_source_feed_url.empty() && i->second->source_feed_url().empty())
i->second->set_source_feed_url(m_source_feed_url); i->second->set_source_feed_url(m_source_feed_url);
// insert this torrent in the uuid index // insert this torrent in the uuid index
if (!m_uuid.empty() || !m_url.empty()) if (!m_uuid.empty() || !m_url.empty())
{ {
m_ses.m_uuids.insert(std::make_pair(m_uuid.empty() m_ses.m_uuids.insert(std::make_pair(m_uuid.empty()
? m_url : m_uuid, i->second)); ? m_url : m_uuid, i->second));
} }
set_error(error_code(errors::duplicate_torrent, get_libtorrent_category()), ""); set_error(error_code(errors::duplicate_torrent, get_libtorrent_category()), "");
abort(); abort();
return; return;
} }
m_ses.m_torrents.insert(std::make_pair(m_torrent_file->info_hash(), me)); m_ses.m_torrents.insert(std::make_pair(m_torrent_file->info_hash(), me));
@@ -1315,6 +1315,9 @@ namespace libtorrent
m_ses.m_io_service.post(boost::bind(&torrent::files_checked, shared_from_this())); m_ses.m_io_service.post(boost::bind(&torrent::files_checked, shared_from_this()));
std::vector<char>().swap(m_resume_data); std::vector<char>().swap(m_resume_data);
lazy_entry().swap(m_resume_entry); lazy_entry().swap(m_resume_entry);
#ifdef TORRENT_DEBUG
m_resume_data_loaded = true;
#endif
return; return;
} }