fixed auto-subscribed of circles when some IDs are unknown

This commit is contained in:
csoler 2016-04-14 23:09:59 -04:00
parent 47dd44292a
commit ba1a1b2a61

View File

@ -37,6 +37,7 @@
/**** /****
* #define DEBUG_CIRCLES 1 * #define DEBUG_CIRCLES 1
****/ ****/
#define DEBUG_CIRCLES 1
RsGxsCircles *rsGxsCircles = NULL; RsGxsCircles *rsGxsCircles = NULL;
@ -119,9 +120,8 @@ p3GxsCircles::p3GxsCircles(RsGeneralDataService *gds, RsNetworkExchangeService *
RsTickEvent::schedule_now(CIRCLE_EVENT_LOADIDS); RsTickEvent::schedule_now(CIRCLE_EVENT_LOADIDS);
// Dummy Circles. // Dummy Circles.
// RsTickEvent::schedule_in(CIRCLE_EVENT_DUMMYSTART, CIRCLE_DUMMY_STARTPERIOD); // RsTickEvent::schedule_in(CIRCLE_EVENT_DUMMYSTART, CIRCLE_DUMMY_STARTPERIOD);
mDummyIdToken = 0; mDummyIdToken = 0;
} }
@ -1114,12 +1114,12 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token)
isUnprocessedPeers = false; 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) if (isComplete)
{ {
checkCircleCacheForAutoSubscribe(cache);
/* move straight into the cache */ /* move straight into the cache */
mCircleCache.store(id, cache); mCircleCache.store(id, cache);
mCircleCache.resize(); mCircleCache.resize();
@ -1266,8 +1266,11 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId)
/* We need to AutoSubscribe if the Circle is relevent to us */ /* We need to AutoSubscribe if the Circle is relevent to us */
bool p3GxsCircles::checkCircleCacheForAutoSubscribe(RsGxsCircleCache &cache) bool p3GxsCircles::checkCircleCacheForAutoSubscribe(RsGxsCircleCache &cache)
{ {
#warning we should also check for items in mLoadingCache in this method.
#ifdef DEBUG_CIRCLES #ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::checkCircleCacheForAutoSubscribe() : "<< cache.mCircleId << std::endl; std::cerr << "p3GxsCircles::checkCircleCacheForAutoSubscribe() : "<< cache.mCircleId << std::endl;
#endif #endif