forked from premiere/premiere-libtorrent
initialize torrent object in libtorrent thread instead of in calling thread
This commit is contained in:
parent
18d269dd62
commit
4abd27b40e
|
@ -208,6 +208,7 @@ namespace libtorrent
|
||||||
|
|
||||||
std::vector<torrent_handle> get_torrents();
|
std::vector<torrent_handle> get_torrents();
|
||||||
|
|
||||||
|
void start_torrent(boost::weak_ptr<torrent> wt);
|
||||||
void check_torrent(boost::shared_ptr<torrent> const& t);
|
void check_torrent(boost::shared_ptr<torrent> const& t);
|
||||||
void done_checking(boost::shared_ptr<torrent> const& t);
|
void done_checking(boost::shared_ptr<torrent> const& t);
|
||||||
|
|
||||||
|
|
|
@ -1834,7 +1834,7 @@ namespace aux {
|
||||||
, params.storage, params.paused, params.resume_data
|
, params.storage, params.paused, params.resume_data
|
||||||
, queue_pos, params.auto_managed));
|
, queue_pos, params.auto_managed));
|
||||||
}
|
}
|
||||||
torrent_ptr->start();
|
m_io_service.post(bind(&session_impl::start_torrent, this, boost::weak_ptr<torrent>(torrent_ptr)));
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||||
for (extension_list_t::iterator i = m_extensions.begin()
|
for (extension_list_t::iterator i = m_extensions.begin()
|
||||||
|
@ -1878,6 +1878,20 @@ namespace aux {
|
||||||
m_queued_for_checking.push_back(t);
|
m_queued_for_checking.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void session_impl::start_torrent(boost::weak_ptr<torrent> wt)
|
||||||
|
{
|
||||||
|
boost::shared_ptr<torrent> t = wt.lock();
|
||||||
|
if (!t) return;
|
||||||
|
|
||||||
|
mutex_t::scoped_lock l(m_mutex);
|
||||||
|
|
||||||
|
INVARIANT_CHECK;
|
||||||
|
|
||||||
|
if (t->is_aborted()) return;
|
||||||
|
|
||||||
|
t->start();
|
||||||
|
}
|
||||||
|
|
||||||
void session_impl::done_checking(boost::shared_ptr<torrent> const& t)
|
void session_impl::done_checking(boost::shared_ptr<torrent> const& t)
|
||||||
{
|
{
|
||||||
if (m_queued_for_checking.empty()) return;
|
if (m_queued_for_checking.empty()) return;
|
||||||
|
|
Loading…
Reference in New Issue