fixed dead lock and fixed a problem in recent shutdown cleanup
This commit is contained in:
parent
a21b852e07
commit
54f0e6b91f
|
@ -337,11 +337,15 @@ namespace detail
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(!m_processing.empty());
|
TORRENT_ASSERT(!m_processing.empty());
|
||||||
TORRENT_ASSERT(m_processing.front() == processing);
|
TORRENT_ASSERT(m_processing.front() == processing);
|
||||||
|
m_processing.pop_front();
|
||||||
|
|
||||||
|
// make sure the lock order is correct
|
||||||
|
l.unlock();
|
||||||
|
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
|
||||||
|
l.lock();
|
||||||
processing->torrent_ptr->abort();
|
processing->torrent_ptr->abort();
|
||||||
|
|
||||||
processing.reset();
|
processing.reset();
|
||||||
m_processing.pop_front();
|
|
||||||
if (!m_processing.empty())
|
if (!m_processing.empty())
|
||||||
{
|
{
|
||||||
processing = m_processing.front();
|
processing = m_processing.front();
|
||||||
|
@ -426,12 +430,13 @@ namespace detail
|
||||||
processing->torrent_ptr->get_handle()
|
processing->torrent_ptr->get_handle()
|
||||||
, e.what()));
|
, e.what()));
|
||||||
}
|
}
|
||||||
TORRENT_ASSERT(!m_processing.empty());
|
|
||||||
|
|
||||||
processing->torrent_ptr->abort();
|
processing->torrent_ptr->abort();
|
||||||
|
|
||||||
|
if (!m_processing.empty()
|
||||||
|
&& m_processing.front() == processing)
|
||||||
|
m_processing.pop_front();
|
||||||
processing.reset();
|
processing.reset();
|
||||||
m_processing.pop_front();
|
|
||||||
if (!m_processing.empty())
|
if (!m_processing.empty())
|
||||||
{
|
{
|
||||||
processing = m_processing.front();
|
processing = m_processing.front();
|
||||||
|
@ -639,7 +644,6 @@ namespace detail
|
||||||
{
|
{
|
||||||
mutex_t::scoped_lock l(m_mutex);
|
mutex_t::scoped_lock l(m_mutex);
|
||||||
if (m_abort) return;
|
if (m_abort) return;
|
||||||
m_io_service.stop();
|
|
||||||
#if defined(TORRENT_LOGGING)
|
#if defined(TORRENT_LOGGING)
|
||||||
(*m_logger) << time_now_string() << " *** ABORT CALLED ***\n";
|
(*m_logger) << time_now_string() << " *** ABORT CALLED ***\n";
|
||||||
#endif
|
#endif
|
||||||
|
@ -659,6 +663,8 @@ namespace detail
|
||||||
i->second->abort();
|
i->second->abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_io_service.stop();
|
||||||
|
|
||||||
mutex::scoped_lock l2(m_checker_impl.m_mutex);
|
mutex::scoped_lock l2(m_checker_impl.m_mutex);
|
||||||
// abort the checker thread
|
// abort the checker thread
|
||||||
m_checker_impl.m_abort = true;
|
m_checker_impl.m_abort = true;
|
||||||
|
|
Loading…
Reference in New Issue