cleaned up save_resume_data

This commit is contained in:
Arvid Norberg 2008-10-17 01:56:36 +00:00
parent d8d0955910
commit c04183d960
1 changed files with 16 additions and 19 deletions

View File

@ -3949,8 +3949,16 @@ namespace libtorrent
{
INVARIANT_CHECK;
if (m_owning_storage.get())
if (!m_owning_storage.get())
{
if (alerts().should_post<save_resume_data_failed_alert>())
{
alerts().post_alert(save_resume_data_failed_alert(get_handle()
, "save resume data failed, torrent is being destructed"));
}
return;
}
TORRENT_ASSERT(m_storage);
if (m_state == torrent_status::queued_for_checking
|| m_state == torrent_status::checking_files)
@ -3960,22 +3968,11 @@ namespace libtorrent
alerts().post_alert(save_resume_data_failed_alert(get_handle()
, "won't save resume data, torrent does not have a complete resume state yet"));
}
return;
}
else
{
m_storage->async_save_resume_data(
bind(&torrent::on_save_resume_data, shared_from_this(), _1, _2));
}
}
else
{
if (alerts().should_post<save_resume_data_failed_alert>())
{
alerts().post_alert(save_resume_data_failed_alert(get_handle()
, "save resume data failed, torrent is being destructed"));
}
}
}
bool torrent::should_check_files() const
{