From 8554f97486d7be4da6aac85d5a33a7a972d28605 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 15 Jul 2012 01:36:56 +0000 Subject: [PATCH] revert shutdown hang fix --- src/connection_queue.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/connection_queue.cpp b/src/connection_queue.cpp index 2f2fab9a0..7b2089632 100644 --- a/src/connection_queue.cpp +++ b/src/connection_queue.cpp @@ -206,6 +206,10 @@ namespace libtorrent return; } + // all entries are connecting, no need to look for new ones + if (m_queue.size() == m_num_connecting) + return; + std::list::iterator i = std::find_if(m_queue.begin() , m_queue.end(), boost::bind(&entry::connecting, _1) == false); @@ -238,6 +242,7 @@ namespace libtorrent if (m_num_connecting >= m_half_open_limit && m_half_open_limit > 0) break; + if (m_num_connecting == m_queue.size()) break; i = std::find_if(i, m_queue.end(), boost::bind(&entry::connecting, _1) == false); } @@ -277,8 +282,7 @@ namespace libtorrent #endif TORRENT_ASSERT(!e || e == error::operation_aborted); - if (e && m_num_connecting == 0) - return; + if (e) return; ptime next_expire = max_time(); ptime now = time_now_hires() + milliseconds(100);