From dacb1ac48d4fb7a9c64d83a596733a82c88a6d2e Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 2 Jan 2009 08:58:51 +0000 Subject: [PATCH] reverted async. call to torrent::start() since it creates an undesirable race condition for file operations --- include/libtorrent/aux_/session_impl.hpp | 1 - src/session_impl.cpp | 16 +--------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 02aa58821..28cefd84d 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -210,7 +210,6 @@ namespace libtorrent std::vector get_torrents(); - void start_torrent(boost::weak_ptr wt); void check_torrent(boost::shared_ptr const& t); void done_checking(boost::shared_ptr const& t); diff --git a/src/session_impl.cpp b/src/session_impl.cpp index bdba6d506..4a2c72c58 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1878,7 +1878,7 @@ namespace aux { , params.storage, params.paused, params.resume_data , queue_pos, params.auto_managed)); } - m_io_service.post(bind(&session_impl::start_torrent, this, boost::weak_ptr(torrent_ptr))); + torrent_ptr->start(); #ifndef TORRENT_DISABLE_EXTENSIONS for (extension_list_t::iterator i = m_extensions.begin() @@ -1922,20 +1922,6 @@ namespace aux { m_queued_for_checking.push_back(t); } - void session_impl::start_torrent(boost::weak_ptr wt) - { - boost::shared_ptr 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 const& t) { INVARIANT_CHECK;