fix connection_queue::close

This commit is contained in:
Arvid Norberg 2008-11-01 01:38:14 +00:00
parent 8c0165b5c4
commit d359e84b34
1 changed files with 7 additions and 12 deletions

View File

@ -119,19 +119,14 @@ namespace libtorrent
m_timer.cancel(ec); m_timer.cancel(ec);
m_abort = true; m_abort = true;
// make a copy of the list to go through, so while (!m_queue.empty())
// that connections removing themseleves won't {
// interfere with the iteration
std::list<entry> closing_entries = m_queue;
// we don't want to call the timeout callback while we're locked // we don't want to call the timeout callback while we're locked
// since that is a recepie for dead-locks // since that is a recepie for dead-locks
l.unlock(); l.unlock();
try { m_queue.front().on_timeout(); } catch (std::exception&) {}
for (std::list<entry>::iterator i = closing_entries.begin() l.lock();
, end(closing_entries.end()); i != end; ++i) m_queue.pop_front();
{
try { i->on_timeout(); } catch (std::exception&) {}
} }
} }