mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-20 12:24:24 -04:00
added some debug info in new circle code
This commit is contained in:
parent
722609a3e6
commit
3a2b9e881b
1 changed files with 17 additions and 7 deletions
|
@ -1905,6 +1905,9 @@ bool p3GxsCircles::processMembershipRequests(uint32_t token)
|
||||||
// * for each circle, keep a list of IDs sorted into membership categories (e.g. keep updated flags for each IDs)
|
// * for each circle, keep a list of IDs sorted into membership categories (e.g. keep updated flags for each IDs)
|
||||||
// Because msg loading is async-ed, the job in split in two methods: one calls the loading, the other one handles the loaded data.
|
// Because msg loading is async-ed, the job in split in two methods: one calls the loading, the other one handles the loaded data.
|
||||||
|
|
||||||
|
#ifdef DEBUG_CIRCLES
|
||||||
|
std::cerr << "Processing circle membership requests." << std::endl;
|
||||||
|
#endif
|
||||||
GxsMsgDataMap msgItems ;
|
GxsMsgDataMap msgItems ;
|
||||||
|
|
||||||
if(!RsGenExchange::getMsgData(token, msgItems))
|
if(!RsGenExchange::getMsgData(token, msgItems))
|
||||||
|
@ -1918,33 +1921,38 @@ bool p3GxsCircles::processMembershipRequests(uint32_t token)
|
||||||
for(GxsMsgDataMap::const_iterator it(msgItems.begin());it!=msgItems.end();++it)
|
for(GxsMsgDataMap::const_iterator it(msgItems.begin());it!=msgItems.end();++it)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mCircleMtx); /********** STACK LOCKED MTX ******/
|
RsStackMutex stack(mCircleMtx); /********** STACK LOCKED MTX ******/
|
||||||
std::cerr << "Circle ID: " << it->first << std::endl;
|
std::cerr << " Circle ID: " << it->first << std::endl;
|
||||||
|
|
||||||
RsGxsCircleId cid ( it->first );
|
RsGxsCircleId cid ( it->first );
|
||||||
|
|
||||||
if (!mCircleCache.is_cached(cid))
|
if (!mCircleCache.is_cached(cid))
|
||||||
{
|
{
|
||||||
std::cerr << "(EE) Circle is not in cache!" << std::endl;
|
std::cerr << " (EE) Circle is not in cache!" << std::endl;
|
||||||
continue ;
|
continue ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the circle ID in cache and process the list of messages to keep the latest order in time.
|
// Find the circle ID in cache and process the list of messages to keep the latest order in time.
|
||||||
|
|
||||||
RsGxsCircleCache& data = mCircleCache.ref(cid);
|
RsGxsCircleCache& data = mCircleCache.ref(cid);
|
||||||
|
std::cerr << " Circle found in cache!" << std::endl;
|
||||||
|
std::cerr << " Retrieving messages..." << std::endl;
|
||||||
|
|
||||||
for(uint32_t i=0;i<it->second.size();++i)
|
for(uint32_t i=0;i<it->second.size();++i)
|
||||||
{
|
{
|
||||||
|
std::cerr << " Group ID: " << it->second[i]->meta.mGroupId << ", Message ID: " << it->second[i]->meta.mMsgId << ": " ;
|
||||||
|
|
||||||
RsGxsCircleSubscriptionRequestItem *item = dynamic_cast<RsGxsCircleSubscriptionRequestItem*>(it->second[i]) ;
|
RsGxsCircleSubscriptionRequestItem *item = dynamic_cast<RsGxsCircleSubscriptionRequestItem*>(it->second[i]) ;
|
||||||
|
|
||||||
if(item == NULL)
|
if(item == NULL)
|
||||||
{
|
{
|
||||||
std::cerr << "(EE) item is not a RsGxsCircleSubscriptionRequestItem. Weird." << std::endl;
|
std::cerr << " (EE) item is not a RsGxsCircleSubscriptionRequestItem. Weird." << std::endl;
|
||||||
continue ;
|
continue ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RsGxsCircleMembershipStatus& info(data.mMembershipStatus[item->meta.mAuthorId]) ;
|
RsGxsCircleMembershipStatus& info(data.mMembershipStatus[item->meta.mAuthorId]) ;
|
||||||
|
|
||||||
|
std::cerr << " is from id " << item->meta.mAuthorId << " " << time(NULL) - item->time_stamp << " seconds ago, " ;
|
||||||
|
|
||||||
if(info.last_subscription_TS < item->time_stamp)
|
if(info.last_subscription_TS < item->time_stamp)
|
||||||
{
|
{
|
||||||
info.last_subscription_TS = item->time_stamp ;
|
info.last_subscription_TS = item->time_stamp ;
|
||||||
|
@ -1954,11 +1962,13 @@ bool p3GxsCircles::processMembershipRequests(uint32_t token)
|
||||||
else if(item->subscription_type == RsGxsCircleSubscriptionRequestItem::SUBSCRIPTION_REQUEST_UNSUBSCRIBE)
|
else if(item->subscription_type == RsGxsCircleSubscriptionRequestItem::SUBSCRIPTION_REQUEST_UNSUBSCRIBE)
|
||||||
info.subscription_flags &= ~GXS_EXTERNAL_CIRCLE_FLAGS_SUBSCRIBED;
|
info.subscription_flags &= ~GXS_EXTERNAL_CIRCLE_FLAGS_SUBSCRIBED;
|
||||||
else
|
else
|
||||||
std::cerr << "(EE) unknown subscription order type " << item->subscription_type << " for circle " << cid << " by id " << item->meta.mAuthorId << std::endl;
|
std::cerr << " (EE) unknown subscription order type: " << item->subscription_type ;
|
||||||
|
|
||||||
|
std::cerr << " UPDATING" << std::endl;
|
||||||
}
|
}
|
||||||
else if(info.last_subscription_TS > item->time_stamp)
|
else if(info.last_subscription_TS > item->time_stamp)
|
||||||
{
|
{
|
||||||
std::cerr << " scheduling for deletion" << std::endl;
|
std::cerr << " Older than last known (" << time(NULL)-info.last_subscription_TS << " seconds ago): deleting." << std::endl;
|
||||||
messages_to_delete[RsGxsGroupId(cid)].push_back(it->second[i]->meta.mMsgId) ;
|
messages_to_delete[RsGxsGroupId(cid)].push_back(it->second[i]->meta.mMsgId) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue