Browse Source

bugfix: vector::iterator

cl-refactor
Vlad Gluhovsky 10 years ago
parent
commit
ff4cbd8dab
  1. 22
      libp2p/Common.h

22
libp2p/Common.h

@ -242,8 +242,26 @@ public:
void stop() { m_stopped = true; DEV_GUARDED(x_timers) m_timers.clear(); }
protected:
void reap();
void reap()
{
Guard l(x_timers);
std::vector<DeadlineOp>::iterator t = m_timers.begin();
while (t != m_timers.end())
if (t->expired())
{
t->wait();
t = m_timers.erase(t);
}
else
t++;
m_timers.emplace_back(m_io, m_reapIntervalMs, [this](boost::system::error_code const& ec)
{
if (!ec)
reap();
});
}
private:
ba::io_service& m_io;
unsigned m_reapIntervalMs;

Loading…
Cancel
Save