From 04fd7f17cab5b4cb3d195a890343d35b191832c9 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 15 Feb 2021 18:42:34 +0100 Subject: [PATCH] fixing update of groups restricted to circles when circle membership changes --- libretroshare/src/gxs/rsgxsnetservice.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 7ba9cc732..888a54aa2 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -2175,15 +2175,19 @@ void RsGxsNetService::updateServerSyncTS() #ifdef NXS_NET_DEBUG_0 GXSNETDEBUG__G(mit->first) << " Group " << mit->first << " is conditionned to circle " << mit->second->mCircleId << ". local Grp TS=" << time(NULL) - mGrpServerUpdate.grpUpdateTS << " secs ago, circle grp server update TS=" << time(NULL) - circle_group_server_ts << " secs ago"; #endif + // We use a max here between grp and msg TS because membership is driven by invite list (grp data) crossed with + // membership requests messages (msg data). - if(circle_group_server_ts > mGrpServerUpdate.grpUpdateTS) + auto circle_membership_ts = std::max(circle_group_server_ts,circle_msg_server_ts); + + if(circle_membership_ts > mGrpServerUpdate.grpUpdateTS) { #ifdef NXS_NET_DEBUG_0 GXSNETDEBUG__G(mit->first) << " - Updating local Grp Server update TS to follow changes in circles." << std::endl; #endif RS_STACK_MUTEX(mNxsMutex) ; - mGrpServerUpdate.grpUpdateTS = circle_group_server_ts ; + mGrpServerUpdate.grpUpdateTS = circle_membership_ts ; } #ifdef NXS_NET_DEBUG_0 else