turned some std::list<PeerId> into std::set, as it automatically prevents duplicates

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8138 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-04-17 21:36:22 +00:00
parent f1309a8cbe
commit c9d5c7b3cb
51 changed files with 269 additions and 266 deletions

View file

@ -2391,7 +2391,7 @@ bool RsGenExchange::getGroupKeys(const RsGxsGroupId &grpId, RsTlvSecurityKeySet
return true;
}
void RsGenExchange::shareGroupPublishKey(const RsGxsGroupId& grpId,const std::list<RsPeerId>& peers)
void RsGenExchange::shareGroupPublishKey(const RsGxsGroupId& grpId,const std::set<RsPeerId>& peers)
{
if(grpId.isNull())
return ;

View file

@ -604,7 +604,7 @@ public:
* sets the message service string
*/
void shareGroupPublishKey(const RsGxsGroupId& grpId,const std::list<RsPeerId>& peers) ;
void shareGroupPublishKey(const RsGxsGroupId& grpId,const std::set<RsPeerId>& peers) ;
protected:

View file

@ -3239,7 +3239,7 @@ void RsGxsNetService::processExplicitGroupRequests()
mExplicitRequest.clear();
}
int RsGxsNetService::sharePublishKey(const RsGxsGroupId& grpId,const std::list<RsPeerId>& peers)
int RsGxsNetService::sharePublishKey(const RsGxsGroupId& grpId,const std::set<RsPeerId>& peers)
{
RS_STACK_MUTEX(mNxsMutex) ;
@ -3264,7 +3264,7 @@ void RsGxsNetService::sharePublishKeysPending()
std::set<RsPeerId> peersOnline;
std::list<RsGxsGroupId> toDelete;
std::map<RsGxsGroupId,std::list<RsPeerId> >::iterator mit ;
std::map<RsGxsGroupId,std::set<RsPeerId> >::iterator mit ;
mNetMgr->getOnlineList(mServiceInfo.mServiceType, peersOnline);
@ -3278,9 +3278,9 @@ void RsGxsNetService::sharePublishKeysPending()
// Compute the set of peers to send to. We start with this, to avoid retrieving the data for nothing.
std::list<RsPeerId> recipients ;
std::list<RsPeerId> offline_recipients ;
std::set<RsPeerId> offline_recipients ;
for(std::list<RsPeerId>::const_iterator it(mit->second.begin());it!=mit->second.end();++it)
for(std::set<RsPeerId>::const_iterator it(mit->second.begin());it!=mit->second.end();++it)
if(peersOnline.find(*it) != peersOnline.end())
{
#ifdef NXS_NET_DEBUG
@ -3293,7 +3293,7 @@ void RsGxsNetService::sharePublishKeysPending()
#ifdef NXS_NET_DEBUG
std::cerr << " " << *it << ": offline. Keeping for next try." << std::endl;
#endif
offline_recipients.push_back(*it) ;
offline_recipients.insert(*it) ;
}
// If empty, skip

View file

@ -135,7 +135,7 @@ public:
* share publish keys for the specified group with the peers in the specified list.
*/
virtual int sharePublishKey(const RsGxsGroupId& grpId,const std::list<RsPeerId>& peers) ;
virtual int sharePublishKey(const RsGxsGroupId& grpId,const std::set<RsPeerId>& peers) ;
/*!
* Returns statistics for the group networking activity: popularity (number of friends subscribers) and max_visible_msg_count,
@ -484,7 +484,7 @@ private:
// need to be verfied
std::vector<AuthorPending*> mPendingResp;
std::vector<GrpCircleVetting*> mPendingCircleVets;
std::map<RsGxsGroupId,std::list<RsPeerId> > mPendingPublishKeyRecipients ;
std::map<RsGxsGroupId,std::set<RsPeerId> > mPendingPublishKeyRecipients ;
std::map<RsPeerId, std::list<RsGxsGroupId> > mExplicitRequest;
std::map<RsPeerId, std::set<RsGxsGroupId> > mPartialMsgUpdates ;

View file

@ -124,7 +124,7 @@ public:
* Request for this group is sent through to peers on your network
* and how many hops from them you've indicated
*/
virtual int sharePublishKey(const RsGxsGroupId& grpId,const std::list<RsPeerId>& peers)=0 ;
virtual int sharePublishKey(const RsGxsGroupId& grpId,const std::set<RsPeerId>& peers)=0 ;
};