Removed unnecessary select of groups in RsGxsNetService::locked_genReqGrpTransaction.

This commit is contained in:
thunder2 2015-08-27 00:54:37 +02:00
parent 753846beaf
commit 4d7f92ecbe

View File

@ -2159,6 +2159,9 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
std::cerr << "locked_genReqGrpTransaction(): " << std::endl; std::cerr << "locked_genReqGrpTransaction(): " << std::endl;
#endif #endif
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMetaMap;
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::const_iterator metaIter;
std::list<RsNxsSyncGrpItem*> grpItemL; std::list<RsNxsSyncGrpItem*> grpItemL;
std::list<RsNxsItem*>::iterator lit = tr->mItems.begin(); std::list<RsNxsItem*>::iterator lit = tr->mItems.begin();
@ -2168,6 +2171,7 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
if(item) if(item)
{ {
grpItemL.push_back(item); grpItemL.push_back(item);
grpMetaMap[item->grpId] = NULL;
}else }else
{ {
#ifdef NXS_NET_DEBUG #ifdef NXS_NET_DEBUG
@ -2177,8 +2181,11 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
} }
} }
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMetaMap; if (grpItemL.empty())
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::const_iterator metaIter; {
return;
}
mDataStore->retrieveGxsGrpMetaData(grpMetaMap); mDataStore->retrieveGxsGrpMetaData(grpMetaMap);
// now do compare and add loop // now do compare and add loop
@ -2198,7 +2205,7 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
metaIter = grpMetaMap.find(grpId); metaIter = grpMetaMap.find(grpId);
bool haveItem = false; bool haveItem = false;
bool latestVersion = false; bool latestVersion = false;
if (metaIter != grpMetaMap.end()) if (metaIter != grpMetaMap.end() && metaIter->second)
{ {
haveItem = true; haveItem = true;
latestVersion = grpSyncItem->publishTs > metaIter->second->mPublishTs; latestVersion = grpSyncItem->publishTs > metaIter->second->mPublishTs;