- Removed randomly forced updating of GUI in RsGxsUpdateBroadcastBase

- Added group changed notify when visible count or suppliers count of a group has changed
- Fixed suppliers count

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8277 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-05-19 21:40:19 +00:00
parent 1f759c4004
commit 69c1df7e2d
5 changed files with 27 additions and 9 deletions

View File

@ -1484,6 +1484,15 @@ void RsGenExchange::notifyReceivePublishKey(const RsGxsGroupId &grpId)
mNotifications.push_back(gc);
}
void RsGenExchange::notifyChangedGroupStats(const RsGxsGroupId &grpId)
{
RS_STACK_MUTEX(mGenMtx);
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PROCESSED, false);
gc->mGrpIdList.push_back(grpId);
mNotifications.push_back(gc);
}
void RsGenExchange::publishGroup(uint32_t& token, RsGxsGrpItem *grpItem)
{

View File

@ -156,6 +156,11 @@ public:
*/
virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId);
/*!
* @param grpId group id
*/
virtual void notifyChangedGroupStats(const RsGxsGroupId &grpId);
/** E: Observer implementation **/
/*!

View File

@ -1873,9 +1873,17 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
RsGroupNetworkStatsRecord& gnsr = mGroupNetworkStats[grpId];
std::set<RsPeerId>::size_type oldSuppliersCount = gnsr.suppliers.size();
uint32_t oldVisibleCount = gnsr.max_visible_count;
gnsr.suppliers.insert(pid) ;
gnsr.max_visible_count = std::max(gnsr.max_visible_count, mcount) ;
if (oldVisibleCount != gnsr.max_visible_count || oldSuppliersCount != gnsr.suppliers.size())
{
mObserver->notifyChangedGroupStats(grpId);
}
#ifdef NXS_NET_DEBUG
std::cerr << " grpId = " << grpId << std::endl;
std::cerr << " retrieving grp mesta data..." << std::endl;
@ -2976,10 +2984,6 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsg* item)
RS_STACK_MUTEX(mNxsMutex) ;
// We do that early, so as to get info about who sends data about which group,
// even when the group doesn't need update.
mGroupNetworkStats[item->grpId].suppliers.insert(item->PeerId()) ;
const RsPeerId& peer = item->PeerId();
#ifdef NXS_NET_DEBUG_0

View File

@ -53,6 +53,11 @@ public:
* @param grpId group id
*/
virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId) = 0;
/*!
* @param grpId group id
*/
virtual void notifyChangedGroupStats(const RsGxsGroupId &grpId) = 0;
};
#endif // RSNXSOBSERVER_H

View File

@ -40,11 +40,6 @@ void RsGxsUpdateBroadcastBase::securedUpdateDisplay()
emit fillDisplay(mFillComplete);
mFillComplete = false;
// Randomly force updating popularity, and other statistics that can only be retrieved through a
// complete update.
if(RSRandom::random_f32() < 0.2)
mFillComplete = true ;
/* Clear updated ids */
mGrpIds.clear();
mGrpIdsMeta.clear(),