mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-23 13:51:12 -05:00
Merge pull request #2369 from G10h4ck/fix_RsGxsNetService_requestGrp
Fix list overwrite in RsGxsNetService::requestGrp
This commit is contained in:
commit
89b6d95197
@ -256,10 +256,8 @@
|
|||||||
#include "util/rstime.h"
|
#include "util/rstime.h"
|
||||||
#include "util/rsmemory.h"
|
#include "util/rsmemory.h"
|
||||||
#include "util/stacktrace.h"
|
#include "util/stacktrace.h"
|
||||||
|
#include "util/rsdebug.h"
|
||||||
#ifdef RS_DEEP_CHANNEL_INDEX
|
#include "util/cxx17retrocompat.h"
|
||||||
# include "deep_search/channelsindex.hpp"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Use the following defines to debug:
|
* Use the following defines to debug:
|
||||||
@ -4806,43 +4804,40 @@ uint32_t RsGxsNetService::getKeepAge(const RsGxsGroupId& grpId)
|
|||||||
return locked_getGrpConfig(grpId).msg_keep_delay ;
|
return locked_getGrpConfig(grpId).msg_keep_delay ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RsGxsNetService::requestGrp(const std::list<RsGxsGroupId>& grpId, const RsPeerId& peerId)
|
int RsGxsNetService::requestGrp(
|
||||||
|
const std::list<RsGxsGroupId>& grpIds, const RsPeerId& peerId )
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mNxsMutex) ;
|
|
||||||
#ifdef NXS_NET_DEBUG_0
|
#ifdef NXS_NET_DEBUG_0
|
||||||
GXSNETDEBUG_P_(peerId) << "RsGxsNetService::requestGrp(): adding explicit group requests to peer " << peerId << std::endl;
|
RS_DBG("Adding explicit groups requests to peer: ", peerId);
|
||||||
|
for(auto& grpId: std::as_const(grpIds)) RS_DBG("\t Group ID: ", grpId);
|
||||||
for(std::list<RsGxsGroupId>::const_iterator it(grpId.begin());it!=grpId.end();++it)
|
|
||||||
GXSNETDEBUG_PG(peerId,*it) << " Group ID: " << *it << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
mExplicitRequest[peerId].assign(grpId.begin(), grpId.end());
|
|
||||||
|
RS_STACK_MUTEX(mNxsMutex);
|
||||||
|
mExplicitRequest[peerId].insert(grpIds.begin(), grpIds.end());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsNetService::processExplicitGroupRequests()
|
void RsGxsNetService::processExplicitGroupRequests()
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mNxsMutex) ;
|
RS_STACK_MUTEX(mNxsMutex);
|
||||||
|
|
||||||
std::map<RsPeerId, std::list<RsGxsGroupId> >::const_iterator cit = mExplicitRequest.begin();
|
for(auto& cit: std::as_const(mExplicitRequest))
|
||||||
|
|
||||||
for(; cit != mExplicitRequest.end(); ++cit)
|
|
||||||
{
|
{
|
||||||
#ifdef NXS_NET_DEBUG_0
|
#ifdef NXS_NET_DEBUG_0
|
||||||
GXSNETDEBUG_P_(cit->first) << "RsGxsNetService::sending pending explicit group requests to peer " << cit->first << std::endl;
|
RS_DBG("sending pending explicit group requests to peer ", cit.first);
|
||||||
#endif
|
#endif
|
||||||
const RsPeerId& peerId = cit->first;
|
const RsPeerId& peerId = cit.first;
|
||||||
const std::list<RsGxsGroupId>& groupIdList = cit->second;
|
const std::set<RsGxsGroupId>& groupIdList = cit.second;
|
||||||
|
|
||||||
std::list<RsNxsItem*> grpSyncItems;
|
std::list<RsNxsItem*> grpSyncItems;
|
||||||
std::list<RsGxsGroupId>::const_iterator git = groupIdList.begin();
|
|
||||||
uint32_t transN = locked_getTransactionId();
|
uint32_t transN = locked_getTransactionId();
|
||||||
for(; git != groupIdList.end(); ++git)
|
for(auto& grpId: std::as_const(groupIdList))
|
||||||
{
|
{
|
||||||
#ifdef NXS_NET_DEBUG_0
|
#ifdef NXS_NET_DEBUG_0
|
||||||
GXSNETDEBUG_P_(peerId) << " group request for grp ID " << *git << " to peer " << peerId << std::endl;
|
RS_DBG("\t group request for group ID: ", grpId);
|
||||||
#endif
|
#endif
|
||||||
RsNxsSyncGrpItem* item = new RsNxsSyncGrpItem(mServType);
|
RsNxsSyncGrpItem* item = new RsNxsSyncGrpItem(mServType);
|
||||||
item->grpId = *git;
|
item->grpId = grpId;
|
||||||
item->PeerId(peerId);
|
item->PeerId(peerId);
|
||||||
item->flag = RsNxsSyncGrpItem::FLAG_REQUEST;
|
item->flag = RsNxsSyncGrpItem::FLAG_REQUEST;
|
||||||
item->transactionNumber = transN;
|
item->transactionNumber = transN;
|
||||||
|
@ -584,7 +584,7 @@ private:
|
|||||||
std::vector<AuthorPending*> mPendingResp;
|
std::vector<AuthorPending*> mPendingResp;
|
||||||
std::vector<GrpCircleVetting*> mPendingCircleVets;
|
std::vector<GrpCircleVetting*> mPendingCircleVets;
|
||||||
std::map<RsGxsGroupId,std::set<RsPeerId> > mPendingPublishKeyRecipients ;
|
std::map<RsGxsGroupId,std::set<RsPeerId> > mPendingPublishKeyRecipients ;
|
||||||
std::map<RsPeerId, std::list<RsGxsGroupId> > mExplicitRequest;
|
std::map<RsPeerId, std::set<RsGxsGroupId> > mExplicitRequest;
|
||||||
std::map<RsPeerId, std::set<RsGxsGroupId> > mPartialMsgUpdates ;
|
std::map<RsPeerId, std::set<RsGxsGroupId> > mPartialMsgUpdates ;
|
||||||
|
|
||||||
// nxs sync optimisation
|
// nxs sync optimisation
|
||||||
|
Loading…
Reference in New Issue
Block a user