fix connection_queue::close
This commit is contained in:
parent
8c0165b5c4
commit
d359e84b34
|
@ -119,19 +119,14 @@ namespace libtorrent
|
|||
m_timer.cancel(ec);
|
||||
m_abort = true;
|
||||
|
||||
// make a copy of the list to go through, so
|
||||
// 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
|
||||
// since that is a recepie for dead-locks
|
||||
l.unlock();
|
||||
|
||||
for (std::list<entry>::iterator i = closing_entries.begin()
|
||||
, end(closing_entries.end()); i != end; ++i)
|
||||
while (!m_queue.empty())
|
||||
{
|
||||
try { i->on_timeout(); } catch (std::exception&) {}
|
||||
// we don't want to call the timeout callback while we're locked
|
||||
// since that is a recepie for dead-locks
|
||||
l.unlock();
|
||||
try { m_queue.front().on_timeout(); } catch (std::exception&) {}
|
||||
l.lock();
|
||||
m_queue.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue