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,32 +3949,29 @@ namespace libtorrent
{
INVARIANT_CHECK;
if (m_owning_storage.get())
{
TORRENT_ASSERT(m_storage);
if (m_state == torrent_status::queued_for_checking
|| m_state == torrent_status::checking_files)
{
if (alerts().should_post<save_resume_data_failed_alert>())
{
alerts().post_alert(save_resume_data_failed_alert(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
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)
{
if (alerts().should_post<save_resume_data_failed_alert>())
{
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;
}
m_storage->async_save_resume_data(
bind(&torrent::on_save_resume_data, shared_from_this(), _1, _2));
}
bool torrent::should_check_files() const