won't save resume data for torrents without a complete state (checking or queued for checking torrents)
This commit is contained in:
parent
84221e05f8
commit
ca0f17ee95
|
@ -1054,11 +1054,14 @@ int main(int ac, char* av[])
|
|||
|
||||
std::auto_ptr<alert> holder = ses.pop_alert();
|
||||
save_resume_data_alert const* rd = dynamic_cast<save_resume_data_alert const*>(a);
|
||||
if (rd == 0)
|
||||
if (!rd)
|
||||
{
|
||||
std::cout << a->msg() << std::endl;
|
||||
continue;
|
||||
}
|
||||
--num_resume_data;
|
||||
|
||||
if (!rd->resume_data) continue;
|
||||
|
||||
torrent_handle h = rd->handle;
|
||||
boost::filesystem::ofstream out(h.save_path()
|
||||
|
@ -1066,7 +1069,6 @@ int main(int ac, char* av[])
|
|||
out.unsetf(std::ios_base::skipws);
|
||||
bencode(std::ostream_iterator<char>(out), *rd->resume_data);
|
||||
std::cout << "fast resume data saved for " << h.name() << std::endl;
|
||||
--num_resume_data;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3686,8 +3686,20 @@ namespace libtorrent
|
|||
if (m_owning_storage.get())
|
||||
{
|
||||
TORRENT_ASSERT(m_storage);
|
||||
m_storage->async_save_resume_data(
|
||||
bind(&torrent::on_save_resume_data, shared_from_this(), _1, _2));
|
||||
if (m_state == torrent_status::queued_for_checking
|
||||
|| m_state == torrent_status::checking_files)
|
||||
{
|
||||
if (alerts().should_post(alert::warning))
|
||||
{
|
||||
alerts().post_alert(save_resume_data_alert(boost::shared_ptr<entry>()
|
||||
, get_handle(), "won't save resume data, torrent does not have a complete resume state yet"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_storage->async_save_resume_data(
|
||||
bind(&torrent::on_save_resume_data, shared_from_this(), _1, _2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue