added missing update of membership status flags when an id is removed from the invitee list

This commit is contained in:
csoler 2020-05-10 18:37:03 +02:00
parent a7d89f1fbb
commit 766da8117a
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
3 changed files with 33 additions and 22 deletions

View file

@ -61,7 +61,7 @@ static const uint32_t INDEX_AUTHEN_ADMIN = 0x00000040; // admin key
#define GXS_MASK "GXS_MASK_HACK"
#define GEN_EXCH_DEBUG 1
//#define GEN_EXCH_DEBUG 1
static const uint32_t MSG_CLEANUP_PERIOD = 60*59; // 59 minutes
static const uint32_t INTEGRITY_CHECK_PERIOD = 60*31; // 31 minutes
@ -1797,6 +1797,7 @@ void RsGenExchange::updateGroup(uint32_t& token, RsGxsGrpItem* grpItem)
if(!checkGroupMetaConsistency(grpItem->meta))
{
std::cerr << "(EE) Cannot update group. Some information was not supplied." << std::endl;
delete grpItem;
return ;
}
@ -2391,9 +2392,8 @@ void RsGenExchange::processGroupUpdatePublish()
// first build meta request map for groups to be updated
RsGxsGrpMetaTemporaryMap grpMeta;
std::vector<GroupUpdatePublish>::iterator vit = mGroupUpdatePublish.begin();
for(; vit != mGroupUpdatePublish.end(); ++vit)
for(auto vit = mGroupUpdatePublish.begin(); vit != mGroupUpdatePublish.end(); ++vit)
{
GroupUpdatePublish& gup = *vit;
const RsGxsGroupId& groupId = gup.grpItem->meta.mGroupId;
@ -2406,8 +2406,7 @@ void RsGenExchange::processGroupUpdatePublish()
mDataStore->retrieveGxsGrpMetaData(grpMeta);
// now
vit = mGroupUpdatePublish.begin();
for(; vit != mGroupUpdatePublish.end(); ++vit)
for(auto vit = mGroupUpdatePublish.begin(); vit != mGroupUpdatePublish.end(); ++vit)
{
GroupUpdatePublish& gup = *vit;
const RsGxsGroupId& groupId = gup.grpItem->meta.mGroupId;

View file

@ -321,7 +321,7 @@ static const uint32_t RS_NXS_ITEM_ENCRYPTION_STATUS_GXS_KEY_MISSING = 0x05 ;
|| defined(NXS_NET_DEBUG_8)
static const RsPeerId peer_to_print = RsPeerId();//std::string("a97fef0e2dc82ddb19200fb30f9ac575")) ;
static const RsGxsGroupId group_id_to_print = RsGxsGroupId() ; // use this to allow to this group id only, or "" for all IDs
static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("66052380f5d1d0c5992e2b55dc402ce6")) ; // use this to allow to this group id only, or "" for all IDs
static const uint32_t service_to_print = RS_SERVICE_GXS_TYPE_GXSCIRCLE; // use this to allow to this service id only, or 0 for all services
// warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums)

View file

@ -40,6 +40,7 @@
/****
* #define DEBUG_CIRCLES 1
****/
#define DEBUG_CIRCLES 1
/*extern*/ RsGxsCircles* rsGxsCircles = nullptr;
@ -1107,6 +1108,17 @@ bool RsGxsCircleCache::loadBaseCircle(const RsGxsCircleGroup& circle)
#endif // DEBUG_CIRCLES
}
// also sweep through the list of subscribed members and remove the membership to those who are not in the invitee list anymore
for(auto& m:mMembershipStatus)
if(circle.mInvitedMembers.find(m.first) == circle.mInvitedMembers.end())
{
m.second.subscription_flags &= ~GXS_EXTERNAL_CIRCLE_FLAGS_IN_ADMIN_LIST;
#ifdef DEBUG_CIRCLES
std::cerr << " member " << m.first << " is not in invitee list. Updating flags to " << std::hex << m.second.subscription_flags << std::dec << std::endl;
#endif // DEBUG_CIRCLES
}
return true;
}