From f65b5f677b4999e2893dbef570211ee0f0e87e40 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 30 Mar 2007 22:00:26 +0000 Subject: [PATCH] fixed incorrect locking that might cause invariant check failures --- src/torrent.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/torrent.cpp b/src/torrent.cpp index 2a241c95f..60ec6fc8f 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -543,6 +543,8 @@ namespace libtorrent void torrent::tracker_warning(std::string const& msg) { + session_impl::mutex_t::scoped_lock l(m_ses.m_mutex); + INVARIANT_CHECK; if (m_ses.m_alerts.should_post(alert::warning)) @@ -558,10 +560,10 @@ namespace libtorrent , int complete , int incomplete) { - INVARIANT_CHECK; - session_impl::mutex_t::scoped_lock l(m_ses.m_mutex); + INVARIANT_CHECK; + m_failed_trackers = 0; // announce intervals less than 5 minutes // are insane. @@ -2816,6 +2818,7 @@ namespace libtorrent tracker_request const&) { session_impl::mutex_t::scoped_lock l(m_ses.m_mutex); + INVARIANT_CHECK; #if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING) @@ -2840,9 +2843,10 @@ namespace libtorrent void torrent::tracker_request_error(tracker_request const& , int response_code, const std::string& str) { + session_impl::mutex_t::scoped_lock l(m_ses.m_mutex); + INVARIANT_CHECK; - session_impl::mutex_t::scoped_lock l(m_ses.m_mutex); #if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING) debug_log(std::string("*** tracker error: ") + str); #endif