← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3328: move a check

 

------------------------------------------------------------
revno: 3328
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Wed 2013-07-31 23:46:23 +0200
message:
  move a check
modified:
  dcpp/Client.cpp
  dcpp/ClientManager.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dcpp/Client.cpp'
--- dcpp/Client.cpp	2013-06-25 11:26:24 +0000
+++ dcpp/Client.cpp	2013-07-31 21:46:23 +0000
@@ -127,7 +127,9 @@
 }
 
 void Client::info() {
-	sock->callAsync([this] { infoImpl(); });
+	if(isConnected()) {
+		sock->callAsync([this] { infoImpl(); });
+	}
 }
 
 void Client::send(const char* aMessage, size_t aLen) {

=== modified file 'dcpp/ClientManager.cpp'
--- dcpp/ClientManager.cpp	2013-06-25 16:04:21 +0000
+++ dcpp/ClientManager.cpp	2013-07-31 21:46:23 +0000
@@ -458,10 +458,8 @@
 
 void ClientManager::infoUpdated() {
 	Lock l(cs);
-	for(auto i: clients) {
-		if(i->isConnected()) {
-			i->info();
-		}
+	for(auto client: clients) {
+		client->info();
 	}
 }
 
@@ -475,8 +473,7 @@
 		return;
 	}
 
-	SearchResultList l;
-	ShareManager::getInstance()->search(l, aString, aSearchType, aSize, aFileType, aClient, isPassive ? 5 : 10);
+	auto l = ShareManager::getInstance()->search(aString, aSearchType, aSize, aFileType, isPassive ? 5 : 10);
 //		dcdebug("Found %d items (%s)\n", l.size(), aString.c_str());
 	if(!l.empty()) {
 		if(isPassive) {
@@ -550,10 +547,8 @@
 		}
 	}
 
-	for(auto j: clients) {
-		if(j->isConnected()) {
-			j->info();
-		}
+	for(auto client: clients) {
+		client->info();
 	}
 }