a bit more robust error messaging when deleting files in a torrent

This commit is contained in:
Arvid Norberg 2013-03-17 00:50:33 +00:00
parent d52a1f8c0a
commit 8d8d160b35
3 changed files with 11 additions and 3 deletions

View File

@ -280,7 +280,7 @@ namespace libtorrent
bool should_check_files() const;
void delete_files();
bool delete_files();
// ============ start deprecation =============
void filter_piece(int index, bool filter);

View File

@ -5279,7 +5279,13 @@ retry:
torrent& t = *i->second;
if (options & session::delete_files)
t.delete_files();
{
if (!t.delete_files())
{
if (alerts().should_post<torrent_delete_failed_alert>())
alerts().post_alert(torrent_delete_failed_alert(t.get_handle(), error_code()));
}
}
tptr->update_guage();

View File

@ -6976,7 +6976,7 @@ namespace libtorrent
return limit;
}
void torrent::delete_files()
bool torrent::delete_files()
{
TORRENT_ASSERT(m_ses.is_network_thread());
@ -6992,7 +6992,9 @@ namespace libtorrent
TORRENT_ASSERT(m_storage);
m_storage->async_delete_files(
boost::bind(&torrent::on_files_deleted, shared_from_this(), _1, _2));
return true;
}
return false;
}
void torrent::clear_error()