From ba1a1b2a61c842cdf7416fe69a218b331d86abdb Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 14 Apr 2016 23:09:59 -0400 Subject: [PATCH] fixed auto-subscribed of circles when some IDs are unknown --- libretroshare/src/services/p3gxscircles.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libretroshare/src/services/p3gxscircles.cc b/libretroshare/src/services/p3gxscircles.cc index 460cdbaab..17cf3efd9 100644 --- a/libretroshare/src/services/p3gxscircles.cc +++ b/libretroshare/src/services/p3gxscircles.cc @@ -37,6 +37,7 @@ /**** * #define DEBUG_CIRCLES 1 ****/ +#define DEBUG_CIRCLES 1 RsGxsCircles *rsGxsCircles = NULL; @@ -119,9 +120,8 @@ p3GxsCircles::p3GxsCircles(RsGeneralDataService *gds, RsNetworkExchangeService * RsTickEvent::schedule_now(CIRCLE_EVENT_LOADIDS); // Dummy Circles. -// RsTickEvent::schedule_in(CIRCLE_EVENT_DUMMYSTART, CIRCLE_DUMMY_STARTPERIOD); - mDummyIdToken = 0; - + // RsTickEvent::schedule_in(CIRCLE_EVENT_DUMMYSTART, CIRCLE_DUMMY_STARTPERIOD); + mDummyIdToken = 0; } @@ -1114,12 +1114,12 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token) isUnprocessedPeers = false; } - + // we can check for self inclusion in the circle right away, since own ids are always loaded. + // that allows to subscribe/unsubscribe uncomplete circles + checkCircleCacheForAutoSubscribe(cache); if (isComplete) { - checkCircleCacheForAutoSubscribe(cache); - /* move straight into the cache */ mCircleCache.store(id, cache); mCircleCache.resize(); @@ -1266,8 +1266,11 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId) /* We need to AutoSubscribe if the Circle is relevent to us */ + bool p3GxsCircles::checkCircleCacheForAutoSubscribe(RsGxsCircleCache &cache) { +#warning we should also check for items in mLoadingCache in this method. + #ifdef DEBUG_CIRCLES std::cerr << "p3GxsCircles::checkCircleCacheForAutoSubscribe() : "<< cache.mCircleId << std::endl; #endif