From 4d7f92ecbea89d05b1b0afa0b014ec0853187b2a Mon Sep 17 00:00:00 2001 From: thunder2 Date: Thu, 27 Aug 2015 00:54:37 +0200 Subject: [PATCH] Removed unnecessary select of groups in RsGxsNetService::locked_genReqGrpTransaction. --- libretroshare/src/gxs/rsgxsnetservice.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index f821e6316..8806b4e1c 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -2159,6 +2159,9 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr) std::cerr << "locked_genReqGrpTransaction(): " << std::endl; #endif + std::map grpMetaMap; + std::map::const_iterator metaIter; + std::list grpItemL; std::list::iterator lit = tr->mItems.begin(); @@ -2168,6 +2171,7 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr) if(item) { grpItemL.push_back(item); + grpMetaMap[item->grpId] = NULL; }else { #ifdef NXS_NET_DEBUG @@ -2177,8 +2181,11 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr) } } - std::map grpMetaMap; - std::map::const_iterator metaIter; + if (grpItemL.empty()) + { + return; + } + mDataStore->retrieveGxsGrpMetaData(grpMetaMap); // now do compare and add loop @@ -2198,7 +2205,7 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr) metaIter = grpMetaMap.find(grpId); bool haveItem = false; bool latestVersion = false; - if (metaIter != grpMetaMap.end()) + if (metaIter != grpMetaMap.end() && metaIter->second) { haveItem = true; latestVersion = grpSyncItem->publishTs > metaIter->second->mPublishTs;