attempt at fixing circle cache loop. Renamed a few variables and fixed logic. Not yet fully working

This commit is contained in:
csoler 2016-03-14 23:19:37 -04:00
parent 83e39d8ae5
commit bdb326a989
8 changed files with 121 additions and 106 deletions

View file

@ -1139,6 +1139,8 @@ void RsGenExchange::receiveChanges(std::vector<RsGxsNotify*>& changes)
} }
delete n; delete n;
} }
changes.clear() ;
RsServer::notify()->notifyGxsChange(out); RsServer::notify()->notifyGxsChange(out);
} }
@ -2798,12 +2800,14 @@ void RsGenExchange::processRecvdGroups()
// group has been validated. Let's notify the global router for the clue // group has been validated. Let's notify the global router for the clue
if(!meta->mAuthorId.isNull())
{
#ifdef GEN_EXCH_DEBUG #ifdef GEN_EXCH_DEBUG
std::cerr << "Group routage info: Identity=" << meta->mAuthorId << " from " << grp->PeerId() << std::endl; std::cerr << "Group routage info: Identity=" << meta->mAuthorId << " from " << grp->PeerId() << std::endl;
#endif #endif
if(!meta->mAuthorId.isNull()) mRoutingClues[meta->mAuthorId].insert(grp->PeerId()) ;
mRoutingClues[meta->mAuthorId].insert(grp->PeerId()) ; }
// This has been moved here (as opposed to inside part for new groups below) because it is used to update the server TS when updates // This has been moved here (as opposed to inside part for new groups below) because it is used to update the server TS when updates
// of grp metadata arrive. // of grp metadata arrive.

View file

@ -111,8 +111,8 @@ class RsGxsCircleDetails
&& mCircleName == rGxsDetails.mCircleName && mCircleName == rGxsDetails.mCircleName
&& mCircleType == rGxsDetails.mCircleType && mCircleType == rGxsDetails.mCircleType
&& mIsExternal == rGxsDetails.mIsExternal && mIsExternal == rGxsDetails.mIsExternal
&& mUnknownPeers == rGxsDetails.mUnknownPeers && mAllowedAnonPeers == rGxsDetails.mAllowedAnonPeers
&& mAllowedPeers == rGxsDetails.mAllowedPeers && mAllowedSignedPeers == rGxsDetails.mAllowedSignedPeers
); );
} }
@ -121,13 +121,13 @@ class RsGxsCircleDetails
|| mCircleName != rGxsDetails.mCircleName || mCircleName != rGxsDetails.mCircleName
|| mCircleType != rGxsDetails.mCircleType || mCircleType != rGxsDetails.mCircleType
|| mIsExternal != rGxsDetails.mIsExternal || mIsExternal != rGxsDetails.mIsExternal
|| mUnknownPeers != rGxsDetails.mUnknownPeers || mAllowedAnonPeers != rGxsDetails.mAllowedAnonPeers
|| mAllowedPeers != rGxsDetails.mAllowedPeers || mAllowedSignedPeers != rGxsDetails.mAllowedSignedPeers
); );
} }
std::set<RsGxsId> mUnknownPeers; std::set<RsGxsId> mAllowedAnonPeers;
std::map<RsPgpId, std::list<RsGxsId> > mAllowedPeers; std::map<RsPgpId, std::list<RsGxsId> > mAllowedSignedPeers;
}; };
class RsGxsCircles: public RsGxsIfaceHelper class RsGxsCircles: public RsGxsIfaceHelper

View file

@ -177,66 +177,72 @@ void p3GxsCircles::service_tick()
void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes) void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
{ {
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::notifyChanges()"; std::cerr << "p3GxsCircles::notifyChanges()";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
std::vector<RsGxsNotify *>::iterator it; std::vector<RsGxsNotify *>::iterator it;
for(it = changes.begin(); it != changes.end(); ++it) for(it = changes.begin(); it != changes.end(); ++it)
{ {
RsGxsGroupChange *groupChange = dynamic_cast<RsGxsGroupChange *>(*it); RsGxsGroupChange *groupChange = dynamic_cast<RsGxsGroupChange *>(*it);
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it); RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
if (msgChange && !msgChange->metaChange()) if (msgChange && !msgChange->metaChange())
{ {
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::notifyChanges() Found Message Change Notification"; std::cerr << " Found Message Change Notification";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap; std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgChangeMap = msgChange->msgChangeMap;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit; std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit;
for(mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit) for(mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit)
{ {
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::notifyChanges() Msgs for Group: " << mit->first; std::cerr << " Msgs for Group: " << mit->first;
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
} }
} }
/* add groups to ExternalIdList (Might get Personal Circles here until NetChecks in place) */ /* add groups to ExternalIdList (Might get Personal Circles here until NetChecks in place) */
if (groupChange && !groupChange->metaChange()) if (groupChange && !groupChange->metaChange())
{ {
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::notifyChanges() Found Group Change Notification"; std::cerr << " Found Group Change Notification";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
std::list<RsGxsGroupId> &groupList = groupChange->mGrpIdList; std::list<RsGxsGroupId> &groupList = groupChange->mGrpIdList;
std::list<RsGxsGroupId>::iterator git; std::list<RsGxsGroupId>::iterator git;
for(git = groupList.begin(); git != groupList.end(); ++git) for(git = groupList.begin(); git != groupList.end(); ++git)
{ {
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::notifyChanges() Incoming Group: " << *git << ". Forcing cache load." << std::endl; std::cerr << " Incoming Group: " << *git << ". Forcing cache load." << std::endl;
#endif #endif
// for new circles we need to add them to the list. // for new circles we need to add them to the list.
// we don't know the type of this circle here // we don't know the type of this circle here
// original behavior was to add all ids to the external ids list // original behavior was to add all ids to the external ids list
addCircleIdToList(RsGxsCircleId(*git), 0); addCircleIdToList(RsGxsCircleId(*git), 0);
cache_request_load(RsGxsCircleId(*git)) ;
// reset the cached circle data for this id
{
RsStackMutex stack(mCircleMtx); /********** STACK LOCKED MTX ******/
mCircleCache.erase(RsGxsCircleId(*git));
}
}
}
}
RsGxsIfaceHelper::receiveChanges(changes);
// reset the cached circle data for this id
{
RsStackMutex stack(mCircleMtx); /********** STACK LOCKED MTX ******/
mCircleCache.erase(RsGxsCircleId(*git));
}
}
}
if(groupChange)
for(std::list<RsGxsGroupId>::const_iterator git(groupChange->mGrpIdList.begin());git!=groupChange->mGrpIdList.end();++git)
{
#ifdef DEBUG_CIRCLES
std::cerr << " forcing cache loading for circle " << *git << " in order to trigger subscribe update." << std::endl;
#endif
cache_request_load(RsGxsCircleId(*git)) ;
}
}
RsGxsIfaceHelper::receiveChanges(changes); // this clear up the vector and delete its elements
} }
/********************************************************************************/ /********************************************************************************/
@ -264,8 +270,8 @@ bool p3GxsCircles:: getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails
details.mCircleType = data.mCircleType; details.mCircleType = data.mCircleType;
details.mIsExternal = data.mIsExternal; details.mIsExternal = data.mIsExternal;
details.mUnknownPeers = data.mUnknownPeers; details.mAllowedAnonPeers = data.mAllowedAnonPeers;
details.mAllowedPeers = data.mAllowedPeers; details.mAllowedSignedPeers = data.mAllowedSignedPeers;
return true; return true;
} }
} }
@ -392,10 +398,10 @@ bool p3GxsCircles::recipients(const RsGxsCircleId& circleId, std::list<RsGxsId>&
if(!getCircleDetails(circleId, details)) if(!getCircleDetails(circleId, details))
return false; return false;
for(std::set<RsGxsId>::const_iterator it(details.mUnknownPeers.begin());it!=details.mUnknownPeers.end();++it) for(std::set<RsGxsId>::const_iterator it(details.mAllowedAnonPeers.begin());it!=details.mAllowedAnonPeers.end();++it)
gxs_ids.push_back(*it) ; gxs_ids.push_back(*it) ;
for(std::map<RsPgpId,std::list<RsGxsId> >::const_iterator it(details.mAllowedPeers.begin());it!=details.mAllowedPeers.end();++it) for(std::map<RsPgpId,std::list<RsGxsId> >::const_iterator it(details.mAllowedSignedPeers.begin());it!=details.mAllowedSignedPeers.end();++it)
for(std::list<RsGxsId>::const_iterator it2(it->second.begin());it2!=it->second.end();++it2) for(std::list<RsGxsId>::const_iterator it2(it->second.begin());it2!=it->second.end();++it2)
gxs_ids.push_back(*it2) ; gxs_ids.push_back(*it2) ;
@ -525,7 +531,7 @@ bool RsGxsCircleCache::loadBaseCircle(const RsGxsCircleGroup &circle)
mCircleId = RsGxsCircleId(circle.mMeta.mGroupId); mCircleId = RsGxsCircleId(circle.mMeta.mGroupId);
mCircleName = circle.mMeta.mGroupName; mCircleName = circle.mMeta.mGroupName;
mUpdateTime = time(NULL); mUpdateTime = time(NULL);
mProcessedCircles.insert(mCircleId); // mProcessedCircles.insert(mCircleId);
mCircleType = circle.mMeta.mCircleType; mCircleType = circle.mMeta.mCircleType;
mIsExternal = (mCircleType != GXS_CIRCLE_TYPE_LOCAL); mIsExternal = (mCircleType != GXS_CIRCLE_TYPE_LOCAL);
@ -556,7 +562,7 @@ bool RsGxsCircleCache::loadSubCircle(const RsGxsCircleCache &subcircle)
bool RsGxsCircleCache::getAllowedPeersList(std::list<RsPgpId> &friendlist) bool RsGxsCircleCache::getAllowedPeersList(std::list<RsPgpId> &friendlist)
{ {
std::map<RsPgpId, std::list<RsGxsId> >::iterator it; std::map<RsPgpId, std::list<RsGxsId> >::iterator it;
for(it = mAllowedPeers.begin(); it != mAllowedPeers.end(); ++it) for(it = mAllowedSignedPeers.begin(); it != mAllowedSignedPeers.end(); ++it)
{ {
friendlist.push_back(it->first); friendlist.push_back(it->first);
} }
@ -565,8 +571,8 @@ bool RsGxsCircleCache::getAllowedPeersList(std::list<RsPgpId> &friendlist)
bool RsGxsCircleCache::isAllowedPeer(const RsPgpId &id) bool RsGxsCircleCache::isAllowedPeer(const RsPgpId &id)
{ {
std::map<RsPgpId, std::list<RsGxsId> >::iterator it = mAllowedPeers.find(id); std::map<RsPgpId, std::list<RsGxsId> >::iterator it = mAllowedSignedPeers.find(id);
if (it != mAllowedPeers.end()) if (it != mAllowedSignedPeers.end())
{ {
return true; return true;
} }
@ -576,7 +582,7 @@ bool RsGxsCircleCache::isAllowedPeer(const RsPgpId &id)
bool RsGxsCircleCache::addAllowedPeer(const RsPgpId &pgpId, const RsGxsId &gxsId) bool RsGxsCircleCache::addAllowedPeer(const RsPgpId &pgpId, const RsGxsId &gxsId)
{ {
/* created if doesn't exist */ /* created if doesn't exist */
std::list<RsGxsId> &gxsList = mAllowedPeers[pgpId]; std::list<RsGxsId> &gxsList = mAllowedSignedPeers[pgpId];
gxsList.push_back(gxsId); gxsList.push_back(gxsId);
return true; return true;
} }
@ -585,7 +591,7 @@ bool RsGxsCircleCache::addAllowedPeer(const RsPgpId &pgpId, const RsGxsId &gxsId
bool RsGxsCircleCache::addLocalFriend(const RsPgpId &pgpId) bool RsGxsCircleCache::addLocalFriend(const RsPgpId &pgpId)
{ {
/* empty list as no GxsID associated */ /* empty list as no GxsID associated */
std::list<RsGxsId> &gxsList = mAllowedPeers[pgpId]; std::list<RsGxsId> &gxsList = mAllowedSignedPeers[pgpId];
return true; return true;
} }
@ -965,7 +971,7 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token)
std::cerr << "p3GxsCircles::cache_load_for_token() Is Unknown -> UnknownPeer: " << *pit; std::cerr << "p3GxsCircles::cache_load_for_token() Is Unknown -> UnknownPeer: " << *pit;
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
cache.mUnknownPeers.insert(*pit); cache.mAllowedAnonPeers.insert(*pit);
} }
} }
else else
@ -1123,9 +1129,7 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId)
RsGxsCircleCache &cache = it->second; RsGxsCircleCache &cache = it->second;
/* try reload Ids */ /* try reload Ids */
std::set<RsGxsId>::const_iterator pit; for(std::set<RsGxsId>::const_iterator pit = cache.mUnprocessedPeers.begin(); pit != cache.mUnprocessedPeers.end(); ++pit)
for(pit = cache.mUnprocessedPeers.begin();
pit != cache.mUnprocessedPeers.end(); ++pit)
{ {
/* check cache */ /* check cache */
if (mIdentities->haveKey(*pit)) if (mIdentities->haveKey(*pit))
@ -1146,7 +1150,7 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId)
} }
else else
{ {
cache.mUnknownPeers.insert(*pit); cache.mAllowedAnonPeers.insert(*pit);
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::cache_reloadids() UnknownPeer: "; std::cerr << "p3GxsCircles::cache_reloadids() UnknownPeer: ";
@ -1176,8 +1180,10 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId)
cache.mUnprocessedPeers.clear(); cache.mUnprocessedPeers.clear();
// If sub-circles are complete too. // If sub-circles are complete too.
#ifdef SUBSCIRCLES
if (cache.mUnprocessedCircles.empty()) if (cache.mUnprocessedCircles.empty())
{ {
#endif
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::cache_reloadids() Adding to cache Id: "; std::cerr << "p3GxsCircles::cache_reloadids() Adding to cache Id: ";
std::cerr << circleId; std::cerr << circleId;
@ -1192,6 +1198,7 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId)
/* remove from loading queue */ /* remove from loading queue */
mLoadingCache.erase(it); mLoadingCache.erase(it);
#ifdef SUBSCIRCLES
} }
else else
{ {
@ -1199,6 +1206,7 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId)
std::cerr << circleId; std::cerr << circleId;
std::cerr << std::endl; std::cerr << std::endl;
} }
#endif
return true; return true;
} }
@ -1208,17 +1216,14 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId)
bool p3GxsCircles::checkCircleCacheForAutoSubscribe(RsGxsCircleCache &cache) bool p3GxsCircles::checkCircleCacheForAutoSubscribe(RsGxsCircleCache &cache)
{ {
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::checkCircleCacheForAutoSubscribe() : "; std::cerr << "p3GxsCircles::checkCircleCacheForAutoSubscribe() : "<< cache.mCircleId << std::endl;
std::cerr << cache.mCircleId;
std::cerr << std::endl;
#endif #endif
/* if processed already - ignore */ /* if processed already - ignore */
if (!(cache.mGroupStatus & GXS_SERV::GXS_GRP_STATUS_UNPROCESSED)) if (!(cache.mGroupStatus & GXS_SERV::GXS_GRP_STATUS_UNPROCESSED))
{ {
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::checkCircleCacheForAutoSubscribe() : Already Processed"; std::cerr << " Already Processed" << std::endl;
std::cerr << std::endl;
#endif #endif
return false; return false;
@ -1228,8 +1233,7 @@ bool p3GxsCircles::checkCircleCacheForAutoSubscribe(RsGxsCircleCache &cache)
if (!cache.mIsExternal) if (!cache.mIsExternal)
{ {
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::checkCircleCacheForAutoSubscribe() : Personal Circle"; std::cerr << " Personal Circle. Nothing to do." << std::endl;
std::cerr << std::endl;
#endif #endif
return false; return false;
@ -1238,9 +1242,9 @@ bool p3GxsCircles::checkCircleCacheForAutoSubscribe(RsGxsCircleCache &cache)
/* if we appear in the group - then autosubscribe, and mark as processed */ /* if we appear in the group - then autosubscribe, and mark as processed */
const RsPgpId& ownId = mPgpUtils->getPGPOwnId(); const RsPgpId& ownId = mPgpUtils->getPGPOwnId();
std::map<RsPgpId, std::list<RsGxsId> >::iterator it = cache.mAllowedPeers.find(ownId);
bool am_I_allowed = it != cache.mAllowedPeers.end() ; std::map<RsPgpId, std::list<RsGxsId> >::iterator it = cache.mAllowedSignedPeers.find(ownId);
bool am_I_allowed = it != cache.mAllowedSignedPeers.end() ;
if(!am_I_allowed) if(!am_I_allowed)
{ {
@ -1249,48 +1253,53 @@ bool p3GxsCircles::checkCircleCacheForAutoSubscribe(RsGxsCircleCache &cache)
rsIdentity->getOwnIds(own_gxs_ids) ; rsIdentity->getOwnIds(own_gxs_ids) ;
for(std::list<RsGxsId>::const_iterator it(own_gxs_ids.begin());it!=own_gxs_ids.end();++it) for(std::list<RsGxsId>::const_iterator it(own_gxs_ids.begin());it!=own_gxs_ids.end();++it)
if(cache.mUnknownPeers.end() != cache.mUnknownPeers.find(*it)) if(cache.mAllowedAnonPeers.end() != cache.mAllowedAnonPeers.find(*it))
{ {
am_I_allowed = true ; am_I_allowed = true ;
#ifdef DEBUG_CIRCLES
std::cerr << " found own GxsId " << *it << " as being in the circle" << std::endl;
#endif
break ; break ;
} }
} }
#ifdef DEBUG_CIRCLES
else
std::cerr << " found own PGP id as signed to one of the circle's GxsIds" << std::endl;
#endif
if(am_I_allowed) if(am_I_allowed)
{ {
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
/* we are part of this group - subscribe, clear unprocessed flag */ /* we are part of this group - subscribe, clear unprocessed flag */
std::cerr << "p3GxsCircles::checkCircleCacheForAutoSubscribe() Found OwnId -> AutoSubscribe!"; std::cerr << " I'm allowed in this circle => AutoSubscribing!" << std::endl;
std::cerr << std::endl;
#endif #endif
uint32_t token, token2; uint32_t token, token2;
RsGenExchange::subscribeToGroup(token, RsGxsGroupId(cache.mCircleId), true); RsGenExchange::subscribeToGroup(token, RsGxsGroupId(cache.mCircleId), true);
RsGenExchange::setGroupStatusFlags(token2, RsGxsGroupId(cache.mCircleId), 0, GXS_SERV::GXS_GRP_STATUS_UNPROCESSED); RsGenExchange::setGroupStatusFlags(token2, RsGxsGroupId(cache.mCircleId), 0, GXS_SERV::GXS_GRP_STATUS_UNPROCESSED);
cache.mGroupStatus ^= GXS_SERV::GXS_GRP_STATUS_UNPROCESSED; cache.mGroupStatus ^= GXS_SERV::GXS_GRP_STATUS_UNPROCESSED;
return true; return true;
} }
else if (cache.mUnknownPeers.empty()) else if (cache.mUnprocessedPeers.empty())
{ {
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::checkCircleCacheForAutoSubscribe() Know All Peers -> Processed"; std::cerr << " Not part of the group! Let's unsubscribe this circle of unfriendly Napoleons!" << std::endl;
std::cerr << std::endl;
#endif #endif
/* we know all the peers - we are not part - we can flag as PROCESSED. */ /* we know all the peers - we are not part - we can flag as PROCESSED. */
uint32_t token; uint32_t token,token2;
RsGenExchange::setGroupStatusFlags(token, RsGxsGroupId(cache.mCircleId.toStdString()), 0, GXS_SERV::GXS_GRP_STATUS_UNPROCESSED); RsGenExchange::setGroupStatusFlags(token, RsGxsGroupId(cache.mCircleId.toStdString()), 0, GXS_SERV::GXS_GRP_STATUS_UNPROCESSED);
RsGenExchange::subscribeToGroup(token2, RsGxsGroupId(cache.mCircleId), false);
cache.mGroupStatus ^= GXS_SERV::GXS_GRP_STATUS_UNPROCESSED; cache.mGroupStatus ^= GXS_SERV::GXS_GRP_STATUS_UNPROCESSED;
return true ;
} }
else else
{ {
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::checkCircleCacheForAutoSubscribe() Leaving Unprocessed"; std::cerr << " Leaving Unprocessed" << std::endl;
std::cerr << std::endl;
#endif #endif
// Don't clear UNPROCESSED - as we might not know all the peers. // Don't clear UNPROCESSED - as we might not know all the peers.
// TODO - work out when we flag as PROCESSED. // TODO - work out when we flag as PROCESSED.
} }

View file

@ -146,12 +146,14 @@ class RsGxsCircleCache
uint32_t mGroupStatus; uint32_t mGroupStatus;
time_t mUpdateTime; time_t mUpdateTime;
#ifdef SUBSCIRCLES
std::set<RsGxsCircleId> mUnprocessedCircles; std::set<RsGxsCircleId> mUnprocessedCircles;
std::set<RsGxsCircleId> mProcessedCircles;
#endif
std::set<RsGxsId> mUnprocessedPeers; std::set<RsGxsId> mUnprocessedPeers;
std::set<RsGxsCircleId> mProcessedCircles; std::set<RsGxsId> mAllowedAnonPeers;
std::set<RsGxsId> mUnknownPeers; std::map<RsPgpId, std::list<RsGxsId> > mAllowedSignedPeers;
std::map<RsPgpId, std::list<RsGxsId> > mAllowedPeers;
}; };

View file

@ -315,7 +315,7 @@ void mark_circle_item(QTreeWidgetItem *item, const std::set<RsPgpId> &names)
std::set<RsPgpId>::iterator it; std::set<RsPgpId>::iterator it;
for(it = names.begin(); it != names.end(); ++it) for(it = names.begin(); it != names.end(); ++it)
{ {
if (details.mAllowedPeers.end() != details.mAllowedPeers.find(*it)) if (details.mAllowedSignedPeers.end() != details.mAllowedSignedPeers.find(*it))
{ {
set_item_background(item, GREEN_BACKGROUND); set_item_background(item, GREEN_BACKGROUND);
std::cerr << "CirclesDialog mark_circle_item: found match: " << id; std::cerr << "CirclesDialog mark_circle_item: found match: " << id;
@ -389,7 +389,7 @@ void CirclesDialog::circle_selected()
/* now mark all the members */ /* now mark all the members */
std::set<RsPgpId> members; std::set<RsPgpId> members;
std::map<RsPgpId, std::list<RsGxsId> >::iterator it; std::map<RsPgpId, std::list<RsGxsId> >::iterator it;
for(it = details.mAllowedPeers.begin(); it != details.mAllowedPeers.end(); ++it) for(it = details.mAllowedSignedPeers.begin(); it != details.mAllowedSignedPeers.end(); ++it)
{ {
members.insert(it->first); members.insert(it->first);
std::cerr << "Circle member: " << it->first; std::cerr << "Circle member: " << it->first;

View file

@ -281,8 +281,8 @@ void CreateCircleDialog::addMember(const QString& keyId, const QString& idtype,
void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails) void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails)
{ {
typedef std::set<RsGxsId>::iterator itUnknownPeers; typedef std::set<RsGxsId>::iterator itUnknownPeers;
for (itUnknownPeers it = cirDetails.mUnknownPeers.begin() for (itUnknownPeers it = cirDetails.mAllowedAnonPeers.begin()
; it != cirDetails.mUnknownPeers.end() ; it != cirDetails.mAllowedAnonPeers.end()
; ++it) { ; ++it) {
RsGxsId gxs_id = *it; RsGxsId gxs_id = *it;
RsIdentityDetails gxs_details ; RsIdentityDetails gxs_details ;
@ -298,8 +298,8 @@ void CreateCircleDialog::addCircle(const RsGxsCircleDetails &cirDetails)
}//for (itUnknownPeers it = cirDetails.mUnknownPeers.begin() }//for (itUnknownPeers it = cirDetails.mUnknownPeers.begin()
typedef std::map<RsPgpId, std::list<RsGxsId> >::const_iterator itAllowedPeers; typedef std::map<RsPgpId, std::list<RsGxsId> >::const_iterator itAllowedPeers;
for (itAllowedPeers it = cirDetails.mAllowedPeers.begin() for (itAllowedPeers it = cirDetails.mAllowedSignedPeers.begin()
; it != cirDetails.mAllowedPeers.end() ; it != cirDetails.mAllowedSignedPeers.end()
; ++it ) { ; ++it ) {
RsPgpId gpg_id = it->first; RsPgpId gpg_id = it->first;
RsPeerDetails details ; RsPeerDetails details ;

View file

@ -532,9 +532,9 @@ void IdDialog::circle_selected()
/* now mark all the members */ /* now mark all the members */
std::set<RsGxsId> members = details.mUnknownPeers; std::set<RsGxsId> members = details.mAllowedAnonPeers;
for(std::map<RsPgpId, std::list<RsGxsId> >::iterator it = details.mAllowedPeers.begin(); it != details.mAllowedPeers.end(); ++it) for(std::map<RsPgpId, std::list<RsGxsId> >::iterator it = details.mAllowedSignedPeers.begin(); it != details.mAllowedSignedPeers.end(); ++it)
for(std::list<RsGxsId>::const_iterator it2=it->second.begin();it2!=it->second.end();++it2) for(std::list<RsGxsId>::const_iterator it2=it->second.begin();it2!=it->second.end();++it2)
{ {
members.insert( (*it2) ) ; members.insert( (*it2) ) ;

View file

@ -54,8 +54,8 @@ void CircleWidget::updateData(const RsGroupMetaData& gxs_group_info
if (_circle_details != details) { if (_circle_details != details) {
_circle_details=details; _circle_details=details;
typedef std::set<RsGxsId>::iterator itUnknownPeers; typedef std::set<RsGxsId>::iterator itUnknownPeers;
for (itUnknownPeers it = _circle_details.mUnknownPeers.begin() for (itUnknownPeers it = _circle_details.mAllowedAnonPeers.begin()
; it != _circle_details.mUnknownPeers.end() ; it != _circle_details.mAllowedAnonPeers.end()
; ++it) { ; ++it) {
RsGxsId gxs_id = *it; RsGxsId gxs_id = *it;
if(!gxs_id.isNull()) { if(!gxs_id.isNull()) {
@ -64,8 +64,8 @@ void CircleWidget::updateData(const RsGroupMetaData& gxs_group_info
}//for (itUnknownPeers it = _circle_details.mUnknownPeers.begin() }//for (itUnknownPeers it = _circle_details.mUnknownPeers.begin()
typedef std::map<RsPgpId, std::list<RsGxsId> >::const_iterator itAllowedPeers; typedef std::map<RsPgpId, std::list<RsGxsId> >::const_iterator itAllowedPeers;
for (itAllowedPeers it = _circle_details.mAllowedPeers.begin() for (itAllowedPeers it = _circle_details.mAllowedSignedPeers.begin()
; it != _circle_details.mAllowedPeers.end() ; it != _circle_details.mAllowedSignedPeers.end()
; ++it ) { ; ++it ) {
RsPgpId pgp_id = it->first; RsPgpId pgp_id = it->first;
emit askForPGPIdentityWidget(pgp_id); emit askForPGPIdentityWidget(pgp_id);