mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-16 18:07:11 -05:00
added update of mServerUpdateTS up to last mRecvTS of each group, which holds the last time the grp meta data was received/modified
This commit is contained in:
parent
a6f0b8dfc1
commit
fafe75dca6
@ -2803,13 +2803,17 @@ void RsGenExchange::processRecvdGroups()
|
|||||||
std::cerr << " Group routage info: Identity=" << meta->mAuthorId << " from " << grp->PeerId() << std::endl;
|
std::cerr << " Group routage info: Identity=" << meta->mAuthorId << " from " << grp->PeerId() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!meta->mAuthorId.isNull())
|
if(!meta->mAuthorId.isNull())
|
||||||
mRoutingClues[meta->mAuthorId].insert(grp->PeerId()) ;
|
mRoutingClues[meta->mAuthorId].insert(grp->PeerId()) ;
|
||||||
|
|
||||||
|
// This has been moved here (as opposed to inside part for new groups below) because it is used to update the server TS when updates
|
||||||
|
// of grp metadata arrive.
|
||||||
|
|
||||||
|
meta->mRecvTS = time(NULL);
|
||||||
|
|
||||||
// now check if group already existss
|
// now check if group already existss
|
||||||
if(std::find(existingGrpIds.begin(), existingGrpIds.end(), grp->grpId) == existingGrpIds.end())
|
if(std::find(existingGrpIds.begin(), existingGrpIds.end(), grp->grpId) == existingGrpIds.end())
|
||||||
{
|
{
|
||||||
meta->mRecvTS = time(NULL);
|
|
||||||
if(meta->mCircleType == GXS_CIRCLE_TYPE_YOUREYESONLY)
|
if(meta->mCircleType == GXS_CIRCLE_TYPE_YOUREYESONLY)
|
||||||
meta->mOriginator = grp->PeerId();
|
meta->mOriginator = grp->PeerId();
|
||||||
|
|
||||||
|
@ -1837,19 +1837,15 @@ void RsGxsNetService::updateServerSyncTS()
|
|||||||
// retrieve all grps and update TS
|
// retrieve all grps and update TS
|
||||||
mDataStore->retrieveGxsGrpMetaData(gxsMap);
|
mDataStore->retrieveGxsGrpMetaData(gxsMap);
|
||||||
|
|
||||||
#ifdef TO_REMOVE
|
// (cyril) This code was previously removed because it sounded inconsistent: the list of grps normally does not need to be updated when
|
||||||
// (cyril) This code is removed because it is inconsistent: the list of grps does not need to be updated when
|
// new posts arrive. The two (grp list and msg list) are handled independently. Still, when group meta data updates are received,
|
||||||
// new posts arrive. The two (grp list and msg list) are handled independently.
|
// the server TS needs to be updated, because it is the only way to propagate the changes. So we update it to the publish time stamp,
|
||||||
|
// if needed.
|
||||||
|
|
||||||
// as a grp list server also note this is the latest item you have
|
// as a grp list server also note this is the latest item you have
|
||||||
if(mGrpServerUpdateItem == NULL)
|
if(mGrpServerUpdateItem == NULL)
|
||||||
mGrpServerUpdateItem = new RsGxsServerGrpUpdateItem(mServType);
|
mGrpServerUpdateItem = new RsGxsServerGrpUpdateItem(mServType);
|
||||||
|
|
||||||
// First reset it. That's important because it will re-compute correct TS in case
|
|
||||||
// we have unsubscribed a group.
|
|
||||||
|
|
||||||
mGrpServerUpdateItem->grpUpdateTS = 0 ;
|
|
||||||
#endif
|
|
||||||
bool change = false;
|
bool change = false;
|
||||||
|
|
||||||
// then remove from mServerMsgUpdateMap, all items that are not in the group list!
|
// then remove from mServerMsgUpdateMap, all items that are not in the group list!
|
||||||
@ -1921,19 +1917,18 @@ void RsGxsNetService::updateServerSyncTS()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TO_REMOVE
|
// This is needed for group metadata updates to actually propagate: only a new grpUpdateTS will trigger the exchange of groups mPublishTs which
|
||||||
// This might be very inefficient with time. This is needed because an old message might have been received, so the last modification time
|
// will then be compared and pssibly trigger a MetaData transmission. mRecvTS is upated when creating, receiving for the first time, or receiving
|
||||||
// needs to account for this so that a friend who hasn't
|
// an update, all in rsgenexchange.cc, after group/update validation. It is therefore a local TS, that can be compared to grpUpdateTS (same machine).
|
||||||
|
|
||||||
if(mGrpServerUpdateItem->grpUpdateTS < grpMeta->mRecvTS)
|
if(mGrpServerUpdateItem->grpUpdateTS < grpMeta->mRecvTS)
|
||||||
{
|
{
|
||||||
#ifdef NXS_NET_DEBUG_0
|
#ifdef NXS_NET_DEBUG_0
|
||||||
GXSNETDEBUG__G(grpId) << " updated msgUpdateTS to last RecvTS = " << time(NULL) - grpMeta->mRecvTS << " secs ago for group "<< grpId << std::endl;
|
GXSNETDEBUG__G(grpId) << " updated msgUpdateTS to last RecvTS = " << time(NULL) - grpMeta->mRecvTS << " secs ago for group "<< grpId << ". This is probably because an update has been received." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
mGrpServerUpdateItem->grpUpdateTS = grpMeta->mRecvTS;
|
mGrpServerUpdateItem->grpUpdateTS = grpMeta->mRecvTS;
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// actual change in config settings, then save configuration
|
// actual change in config settings, then save configuration
|
||||||
|
Loading…
Reference in New Issue
Block a user