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
This commit is contained in:
thunder2 2011-08-04 23:27:58 +00:00
parent 8066862833
commit 23e49f7302

View File

@ -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()) {