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);