fix etensions being passed all alerts

This commit is contained in:
Arvid Norberg 2015-04-07 00:50:21 +00:00
parent 23e5fd3d8f
commit 20aa53953c
3 changed files with 11 additions and 6 deletions

View File

@ -87,7 +87,7 @@ namespace libtorrent {
T alert(m_allocations[m_generation], std::forward<Args>(args)...);
m_alerts[m_generation].push_back(alert);
maybe_notify(lock);
maybe_notify(&alert, lock);
}
#else
@ -157,7 +157,7 @@ namespace libtorrent {
alert_manager(alert_manager const&);
alert_manager& operator=(alert_manager const&);
void maybe_notify(mutex::scoped_lock& lock);
void maybe_notify(alert* a, mutex::scoped_lock& lock);
mutable mutex m_mutex;
condition_variable m_condition;

View File

@ -1,6 +1,5 @@
#if !BOOST_PP_IS_ITERATING
// set-up iteration
#include <boost/preprocessor/repetition/enum_params.hpp>
@ -47,7 +46,7 @@
BOOST_PP_ENUM_PARAMS(I, a));
m_alerts[m_generation].push_back(alert);
maybe_notify(lock);
maybe_notify(&alert, lock);
}
#undef I

View File

@ -71,9 +71,15 @@ namespace libtorrent
return NULL;
}
void alert_manager::maybe_notify(mutex::scoped_lock& lock)
void alert_manager::maybe_notify(alert* a, mutex::scoped_lock& lock)
{
#ifndef TORRENT_DISABLE_EXTENSIONS
for (ses_extension_list_t::iterator i = m_ses_extensions.begin()
, end(m_ses_extensions.end()); i != end; ++i)
{
(*i)->on_alert(a);
}
#endif
if (m_alerts[m_generation].size() == 1)
{
lock.unlock();