diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index fd6182eda..eaf1d5ebb 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -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) { diff --git a/libretroshare/src/gxs/rsgenexchange.h b/libretroshare/src/gxs/rsgenexchange.h index da29c3f3b..436ecc88b 100644 --- a/libretroshare/src/gxs/rsgenexchange.h +++ b/libretroshare/src/gxs/rsgenexchange.h @@ -156,6 +156,11 @@ public: */ virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId); + /*! + * @param grpId group id + */ + virtual void notifyChangedGroupStats(const RsGxsGroupId &grpId); + /** E: Observer implementation **/ /*! diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 20f8bd3a3..9f74eb818 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -1873,9 +1873,17 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr) RsGroupNetworkStatsRecord& gnsr = mGroupNetworkStats[grpId]; + std::set::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 diff --git a/libretroshare/src/gxs/rsnxsobserver.h b/libretroshare/src/gxs/rsnxsobserver.h index 2dfb91bdc..2b25fc950 100644 --- a/libretroshare/src/gxs/rsnxsobserver.h +++ b/libretroshare/src/gxs/rsnxsobserver.h @@ -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 diff --git a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastBase.cpp b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastBase.cpp index da3ee384a..b80180c9a 100644 --- a/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastBase.cpp +++ b/retroshare-gui/src/gui/gxs/RsGxsUpdateBroadcastBase.cpp @@ -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(),