more asserts around state updates
This commit is contained in:
parent
48e7b35a93
commit
ed56520d24
|
@ -503,7 +503,11 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_to_update_queue(boost::weak_ptr<torrent> t)
|
void add_to_update_queue(boost::weak_ptr<torrent> t)
|
||||||
{ m_state_updates.push_back(t); }
|
{
|
||||||
|
TORRENT_ASSERT(std::find_if(m_state_updates.begin(), m_state_updates.end()
|
||||||
|
, boost::bind(&boost::weak_ptr<torrent>::lock, _1) == t.lock()) == m_state_updates.end());
|
||||||
|
m_state_updates.push_back(t);
|
||||||
|
}
|
||||||
|
|
||||||
// private:
|
// private:
|
||||||
|
|
||||||
|
|
|
@ -4548,6 +4548,10 @@ namespace aux {
|
||||||
|
|
||||||
void session_impl::post_torrent_updates()
|
void session_impl::post_torrent_updates()
|
||||||
{
|
{
|
||||||
|
INVARIANT_CHECK;
|
||||||
|
|
||||||
|
TORRENT_ASSERT(is_network_thread());
|
||||||
|
|
||||||
std::auto_ptr<state_update_alert> alert(new state_update_alert());
|
std::auto_ptr<state_update_alert> alert(new state_update_alert());
|
||||||
alert->status.reserve(m_state_updates.size());
|
alert->status.reserve(m_state_updates.size());
|
||||||
|
|
||||||
|
@ -4557,8 +4561,8 @@ namespace aux {
|
||||||
boost::shared_ptr<torrent> t = i->lock();
|
boost::shared_ptr<torrent> t = i->lock();
|
||||||
if (!t) continue;
|
if (!t) continue;
|
||||||
alert->status.push_back(torrent_status());
|
alert->status.push_back(torrent_status());
|
||||||
t->clear_in_state_update();
|
|
||||||
t->status(&alert->status.back(), 0xffffffff);
|
t->status(&alert->status.back(), 0xffffffff);
|
||||||
|
t->clear_in_state_update();
|
||||||
}
|
}
|
||||||
m_state_updates.clear();
|
m_state_updates.clear();
|
||||||
|
|
||||||
|
|
|
@ -7999,7 +7999,13 @@ namespace libtorrent
|
||||||
// we're either not subscribing to this torrent, or
|
// we're either not subscribing to this torrent, or
|
||||||
// it has already been updated this round, no need to
|
// it has already been updated this round, no need to
|
||||||
// add it to the list twice
|
// add it to the list twice
|
||||||
if (!m_state_subscription || m_in_state_updates) return;
|
if (!m_state_subscription) return;
|
||||||
|
if (m_in_state_updates)
|
||||||
|
{
|
||||||
|
TORRENT_ASSERT(std::find_if(m_ses.m_state_updates.begin(), m_ses.m_state_updates.end()
|
||||||
|
, boost::bind(&boost::weak_ptr<torrent>::lock, _1) == shared_from_this()) != m_ses.m_state_updates.end());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_ses.add_to_update_queue(shared_from_this());
|
m_ses.add_to_update_queue(shared_from_this());
|
||||||
m_in_state_updates = true;
|
m_in_state_updates = true;
|
||||||
|
|
Loading…
Reference in New Issue