include info-hash in torrent_status and post event when disk cache is fully flushed when deleting a torrent

This commit is contained in:
Arvid Norberg 2011-04-19 08:21:09 +00:00
parent a15b23f8e8
commit 86d52bbe13
4 changed files with 15 additions and 8 deletions

View File

@ -3368,6 +3368,8 @@ It contains the following fields::
int queue_position;
bool need_save_resume;
bool ip_filter_applies;
sha1_hash info_hash;
};
``handle`` is a handle to the torrent whose status the object represents.
@ -3641,6 +3643,8 @@ was saved.
``ip_filter_applies`` is true if the session global IP filter applies
to this torrent. This defaults to true.
``info_hash`` is the info-hash of the torrent.
peer_info
=========
@ -7046,6 +7050,8 @@ cache_flushed_alert
This alert is posted when the disk cache has been flushed for a specific torrent
as a result of a call to `flush_cache()`_. This alert belongs to the
``storage_notification`` category, which must be enabled to let this alert through.
The alert is also posted when removing a torrent from the session, once the outstanding
cache flush is complete and the torrent does no longer have any files open.
::

View File

@ -833,7 +833,6 @@ namespace libtorrent
void on_files_deleted(int ret, disk_io_job const& j);
void on_files_released(int ret, disk_io_job const& j);
void on_torrent_aborted(int ret, disk_io_job const& j);
void on_torrent_paused(int ret, disk_io_job const& j);
void on_storage_moved(int ret, disk_io_job const& j);
void on_save_resume_data(int ret, disk_io_job const& j);

View File

@ -478,6 +478,7 @@ namespace libtorrent
, queue_position(0)
, need_save_resume(false)
, ip_filter_applies(true)
, info_hash(0)
{}
// handle to the torrent
@ -690,6 +691,9 @@ namespace libtorrent
// defaults to true. Determines whether the session
// IP filter applies to this torrent or not
bool ip_filter_applies;
// the info-hash for this torrent
sha1_hash info_hash;
};
}

View File

@ -3079,7 +3079,7 @@ namespace libtorrent
{
m_storage->abort_disk_io();
m_storage->async_release_files(
boost::bind(&torrent::on_torrent_aborted, shared_from_this(), _1, _2));
boost::bind(&torrent::on_cache_flushed, shared_from_this(), _1, _2));
}
dequeue_torrent_check();
@ -3187,12 +3187,6 @@ namespace libtorrent
*/
}
void torrent::on_torrent_aborted(int ret, disk_io_job const& j)
{
// the torrent should be completely shut down now, and the
// destructor has to be called from the main thread
}
void torrent::on_save_resume_data(int ret, disk_io_job const& j)
{
TORRENT_ASSERT(m_ses.is_network_thread());
@ -6140,6 +6134,9 @@ namespace libtorrent
void torrent::on_cache_flushed(int ret, disk_io_job const& j)
{
TORRENT_ASSERT(m_ses.is_network_thread());
if (m_ses.is_aborted()) return;
if (alerts().should_post<cache_flushed_alert>())
alerts().post_alert(cache_flushed_alert(get_handle()));
}
@ -7320,6 +7317,7 @@ namespace libtorrent
ptime now = time_now();
st->handle = get_handle();
st->info_hash = info_hash();
st->has_incoming = m_has_incoming;
if (m_error) st->error = m_error.message() + ": " + m_error_file;