lt sync 2946
This commit is contained in:
parent
c429d56170
commit
e52efde4db
|
@ -88,6 +88,7 @@ namespace libtorrent
|
|||
, rename_file
|
||||
, abort_thread
|
||||
, clear_read_cache
|
||||
, abort_torrent
|
||||
};
|
||||
|
||||
action_t action;
|
||||
|
|
|
@ -236,6 +236,8 @@ namespace libtorrent
|
|||
boost::function<void(int, disk_io_job const&)> const& handler
|
||||
= boost::function<void(int, disk_io_job const&)>());
|
||||
|
||||
void abort_disk_io();
|
||||
|
||||
void async_clear_read_cache(
|
||||
boost::function<void(int, disk_io_job const&)> const& handler
|
||||
= boost::function<void(int, disk_io_job const&)>());
|
||||
|
|
|
@ -178,7 +178,10 @@ namespace libtorrent
|
|||
}
|
||||
++i;
|
||||
}
|
||||
m_signal.notify_all();
|
||||
disk_io_job j;
|
||||
j.action = disk_io_job::abort_torrent;
|
||||
j.storage = s;
|
||||
add_job(j);
|
||||
}
|
||||
|
||||
bool range_overlap(int start1, int length1, int start2, int length2)
|
||||
|
@ -802,6 +805,28 @@ namespace libtorrent
|
|||
|
||||
switch (j.action)
|
||||
{
|
||||
case disk_io_job::abort_torrent:
|
||||
{
|
||||
mutex_t::scoped_lock jl(m_queue_mutex);
|
||||
for (std::list<disk_io_job>::iterator i = m_jobs.begin();
|
||||
i != m_jobs.end();)
|
||||
{
|
||||
if (i->storage != j.storage)
|
||||
{
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
if (i->action == disk_io_job::check_files)
|
||||
{
|
||||
if (i->callback) m_ios.post(bind(i->callback
|
||||
, piece_manager::disk_check_aborted, *i));
|
||||
m_jobs.erase(i++);
|
||||
continue;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case disk_io_job::abort_thread:
|
||||
{
|
||||
mutex_t::scoped_lock jl(m_queue_mutex);
|
||||
|
|
|
@ -1331,6 +1331,11 @@ namespace libtorrent
|
|||
m_io_thread.add_job(j, handler);
|
||||
}
|
||||
|
||||
void piece_manager::abort_disk_io()
|
||||
{
|
||||
m_io_thread.stop(this);
|
||||
}
|
||||
|
||||
void piece_manager::async_delete_files(
|
||||
boost::function<void(int, disk_io_job const&)> const& handler)
|
||||
{
|
||||
|
|
|
@ -1606,8 +1606,11 @@ namespace libtorrent
|
|||
// files belonging to the torrents
|
||||
disconnect_all();
|
||||
if (m_owning_storage.get())
|
||||
{
|
||||
m_storage->async_release_files(
|
||||
bind(&torrent::on_files_released, shared_from_this(), _1, _2));
|
||||
m_storage->abort_disk_io();
|
||||
}
|
||||
|
||||
if (m_state == torrent_status::checking_files)
|
||||
m_ses.done_checking(shared_from_this());
|
||||
|
|
Loading…
Reference in New Issue