mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-22 05:14:31 -04:00
- 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:
parent
1f759c4004
commit
69c1df7e2d
5 changed files with 27 additions and 9 deletions
|
@ -1484,6 +1484,15 @@ void RsGenExchange::notifyReceivePublishKey(const RsGxsGroupId &grpId)
|
||||||
mNotifications.push_back(gc);
|
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)
|
void RsGenExchange::publishGroup(uint32_t& token, RsGxsGrpItem *grpItem)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId);
|
virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @param grpId group id
|
||||||
|
*/
|
||||||
|
virtual void notifyChangedGroupStats(const RsGxsGroupId &grpId);
|
||||||
|
|
||||||
/** E: Observer implementation **/
|
/** E: Observer implementation **/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -1873,9 +1873,17 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
|
||||||
|
|
||||||
RsGroupNetworkStatsRecord& gnsr = mGroupNetworkStats[grpId];
|
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.suppliers.insert(pid) ;
|
||||||
gnsr.max_visible_count = std::max(gnsr.max_visible_count, mcount) ;
|
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
|
#ifdef NXS_NET_DEBUG
|
||||||
std::cerr << " grpId = " << grpId << std::endl;
|
std::cerr << " grpId = " << grpId << std::endl;
|
||||||
std::cerr << " retrieving grp mesta data..." << std::endl;
|
std::cerr << " retrieving grp mesta data..." << std::endl;
|
||||||
|
@ -2976,10 +2984,6 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsg* item)
|
||||||
|
|
||||||
RS_STACK_MUTEX(mNxsMutex) ;
|
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();
|
const RsPeerId& peer = item->PeerId();
|
||||||
|
|
||||||
#ifdef NXS_NET_DEBUG_0
|
#ifdef NXS_NET_DEBUG_0
|
||||||
|
|
|
@ -53,6 +53,11 @@ public:
|
||||||
* @param grpId group id
|
* @param grpId group id
|
||||||
*/
|
*/
|
||||||
virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId) = 0;
|
virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @param grpId group id
|
||||||
|
*/
|
||||||
|
virtual void notifyChangedGroupStats(const RsGxsGroupId &grpId) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RSNXSOBSERVER_H
|
#endif // RSNXSOBSERVER_H
|
||||||
|
|
|
@ -40,11 +40,6 @@ void RsGxsUpdateBroadcastBase::securedUpdateDisplay()
|
||||||
emit fillDisplay(mFillComplete);
|
emit fillDisplay(mFillComplete);
|
||||||
mFillComplete = false;
|
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 */
|
/* Clear updated ids */
|
||||||
mGrpIds.clear();
|
mGrpIds.clear();
|
||||||
mGrpIdsMeta.clear(),
|
mGrpIdsMeta.clear(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue