add info_hash to torrent_delete_failed_alert

This commit is contained in:
Arvid Norberg 2013-10-27 23:39:24 +00:00
parent cbe3a72a6e
commit aa4064316e
4 changed files with 17 additions and 9 deletions

View File

@ -961,12 +961,14 @@ namespace libtorrent
}; };
// This alert is generated when a request to delete the files of a torrent fails. // This alert is generated when a request to delete the files of a torrent fails.
// Just removing a torrent from the session cannot fail
struct TORRENT_EXPORT torrent_delete_failed_alert: torrent_alert struct TORRENT_EXPORT torrent_delete_failed_alert: torrent_alert
{ {
// internal // internal
torrent_delete_failed_alert(torrent_handle const& h, error_code const& e) torrent_delete_failed_alert(torrent_handle const& h, error_code const& e, sha1_hash const& ih)
: torrent_alert(h) : torrent_alert(h)
, error(e) , error(e)
, info_hash(ih)
{ {
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
msg = convert_from_native(error.message()); msg = convert_from_native(error.message());
@ -987,6 +989,9 @@ namespace libtorrent
// tells you why it failed. // tells you why it failed.
error_code error; error_code error;
// the info hash of the torrent whose files failed to be deleted
sha1_hash info_hash;
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
std::string msg; std::string msg;
#endif #endif

View File

@ -668,12 +668,14 @@ namespace libtorrent
}; };
// ``remove_torrent()`` will close all peer connections associated with the torrent and tell // ``remove_torrent()`` will close all peer connections associated with the torrent and tell
// the tracker that we've stopped participating in the swarm. The optional second argument // the tracker that we've stopped participating in the swarm. This operation cannot fail.
// `options`` can be used to delete all the files downloaded by this torrent. To do this, pass // When it completes, you will receive a torrent_removed_alert.
// in the value ``session::delete_files``. The removal of the torrent is asyncronous, there is //
// no guarantee that adding the same torrent immediately after it was removed will not throw // The optional second argument ``options`` can be used to delete all the files downloaded
// a libtorrent_exception exception. Once the torrent is deleted, a torrent_deleted_alert // by this torrent. To do so, pass in the value ``session::delete_files``. The removal
// is posted. // of the torrent is asyncronous, there is no guarantee that adding the same torrent
// immediately after it was removed will not throw a libtorrent_exception exception. Once
// the torrent is deleted, a torrent_deleted_alert is posted.
void remove_torrent(const torrent_handle& h, int options = 0); void remove_torrent(const torrent_handle& h, int options = 0);
// Sets the session settings and the packet encryption settings respectively. // Sets the session settings and the packet encryption settings respectively.

View File

@ -5530,7 +5530,8 @@ retry:
if (!t.delete_files()) if (!t.delete_files())
{ {
if (m_alerts.should_post<torrent_delete_failed_alert>()) if (m_alerts.should_post<torrent_delete_failed_alert>())
m_alerts.post_alert(torrent_delete_failed_alert(t.get_handle(), error_code())); m_alerts.post_alert(torrent_delete_failed_alert(t.get_handle()
, error_code(), t.torrent_file().info_hash()));
} }
} }

View File

@ -3709,7 +3709,7 @@ namespace libtorrent
if (ret != 0) if (ret != 0)
{ {
alerts().post_alert(torrent_delete_failed_alert(get_handle(), j.error)); alerts().post_alert(torrent_delete_failed_alert(get_handle(), j.error, m_torrent_file->info_hash()));
} }
else else
{ {