re-disabled the code to update the server TS to last post as it can severely perturbate the distribution of posts. Added a call to update msgServerUpdateMap when new messages received

This commit is contained in:
csoler 2016-08-01 16:35:19 +02:00
parent d6be4404d2
commit 3cd90ae11c
2 changed files with 22 additions and 7 deletions

View File

@ -2096,14 +2096,16 @@ void RsGxsNetService::updateServerSyncTS()
else
msui = mapIT->second;
if(grpMeta->mLastPost > msui->msgUpdateTS )
{
change = true;
msui->msgUpdateTS = grpMeta->mLastPost;
// (cyril) I'm removing this, becuse mLastPost is *never* updated. So this code it not useful at all.
//
// if(grpMeta->mLastPost > msui->msgUpdateTS )
// {
// change = true;
// msui->msgUpdateTS = grpMeta->mLastPost;
#ifdef NXS_NET_DEBUG_0
GXSNETDEBUG__G(grpId) << " updated msgUpdateTS to last post = " << time(NULL) - grpMeta->mLastPost << " secs ago for group "<< grpId << std::endl;
// GXSNETDEBUG__G(grpId) << " updated msgUpdateTS to last post = " << time(NULL) - grpMeta->mLastPost << " secs ago for group "<< grpId << std::endl;
#endif
}
// }
// This is needed for group metadata updates to actually propagate: only a new grpUpdateTS will trigger the exchange of groups mPublishTs which
// will then be compared and pssibly trigger a MetaData transmission. mRecvTS is upated when creating, receiving for the first time, or receiving
@ -2596,6 +2598,8 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
// for the grp id
locked_doMsgUpdateWork(tr->mTransaction, grpId);
// also update server sync TS, since we need to send the new message list to friends for comparison
locked_stampMsgServerUpdateTS(grpId);
}
}
else if(tr->mFlag == NxsTransaction::FLAG_STATE_FAILED)
@ -4897,6 +4901,11 @@ bool RsGxsNetService::stampMsgServerUpdateTS(const RsGxsGroupId& gid)
{
RS_STACK_MUTEX(mNxsMutex) ;
locked_stampMsgServerUpdateTS(gid) ;
}
bool RsGxsNetService::locked_stampMsgServerUpdateTS(const RsGxsGroupId& gid)
{
std::map<RsGxsGroupId,RsGxsServerMsgUpdateItem*>::iterator it = mServerMsgUpdateMap.find(gid) ;
if(mServerMsgUpdateMap.end() == it)
@ -4910,4 +4919,3 @@ bool RsGxsNetService::stampMsgServerUpdateTS(const RsGxsGroupId& gid)
return true;
}

View File

@ -229,6 +229,13 @@ private:
*/
void locked_completeTransaction(NxsTransaction* trans);
/*!
* \brief locked_stampMsgServerUpdateTS
* updates the server msg time stamp. This function is the locked method for the one above with similar name
* \param gid group id to stamp.
* \return
*/
bool locked_stampMsgServerUpdateTS(const RsGxsGroupId& gid);
/*!
* This retrieves a unique transaction id that
* can be used in an outgoing transaction