From 23e49f73020ebca1ea9027edeb6e2bf3d686cb56 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Thu, 4 Aug 2011 23:27:58 +0000 Subject: [PATCH] Optimized the Windows connection hack. Suppressed unnecessary count of connection attempts when no connection is waiting. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4531 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/pqipersongrp.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/pqi/pqipersongrp.cc b/libretroshare/src/pqi/pqipersongrp.cc index b6a543efb..9331a3c76 100644 --- a/libretroshare/src/pqi/pqipersongrp.cc +++ b/libretroshare/src/pqi/pqipersongrp.cc @@ -317,6 +317,13 @@ void pqipersongrp::statusChanged() return; } + /* there is no need for a mutex for waitingIds */ + + if (waitingIds.empty()) { + /* nothing to do */ + return; + } + /* check for active connections and start waiting id's */ long connect_count = 0; @@ -357,8 +364,6 @@ void pqipersongrp::statusChanged() std::cerr << "pqipersongrp::connectPeer() There are " << connect_count << " connection attempts and " << waitingIds.size() << " waiting connections. Can start " << (MAX_CONNECT_COUNT - connect_count) << " connection attempts." << std::endl; #endif - /* there is no need for a mutex for waitingIds */ - /* start some waiting id's */ for (int i = connect_count; i < MAX_CONNECT_COUNT; i++) { if (waitingIds.empty()) {