fixed incorrect locking that might cause invariant check failures

This commit is contained in:
Arvid Norberg 2007-03-30 22:00:26 +00:00
parent c9fac1efa0
commit f65b5f677b
1 changed files with 7 additions and 3 deletions

View File

@ -543,6 +543,8 @@ namespace libtorrent
void torrent::tracker_warning(std::string const& msg) void torrent::tracker_warning(std::string const& msg)
{ {
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
INVARIANT_CHECK; INVARIANT_CHECK;
if (m_ses.m_alerts.should_post(alert::warning)) if (m_ses.m_alerts.should_post(alert::warning))
@ -558,10 +560,10 @@ namespace libtorrent
, int complete , int complete
, int incomplete) , int incomplete)
{ {
INVARIANT_CHECK;
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex); session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
INVARIANT_CHECK;
m_failed_trackers = 0; m_failed_trackers = 0;
// announce intervals less than 5 minutes // announce intervals less than 5 minutes
// are insane. // are insane.
@ -2816,6 +2818,7 @@ namespace libtorrent
tracker_request const&) tracker_request const&)
{ {
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex); session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
INVARIANT_CHECK; INVARIANT_CHECK;
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING) #if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
@ -2840,9 +2843,10 @@ namespace libtorrent
void torrent::tracker_request_error(tracker_request const& void torrent::tracker_request_error(tracker_request const&
, int response_code, const std::string& str) , int response_code, const std::string& str)
{ {
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
INVARIANT_CHECK; INVARIANT_CHECK;
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING) #if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
debug_log(std::string("*** tracker error: ") + str); debug_log(std::string("*** tracker error: ") + str);
#endif #endif