mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-17 10:59:38 -04:00
added missing time stamp of msgServerUpdateMap when posting a new message
This commit is contained in:
parent
5fac5a8d76
commit
b1288bcb7e
5 changed files with 53 additions and 10 deletions
|
@ -2019,6 +2019,9 @@ void RsGenExchange::publishMsgs()
|
||||||
|
|
||||||
delete[] metaDataBuff;
|
delete[] metaDataBuff;
|
||||||
|
|
||||||
|
if(mNetService != NULL)
|
||||||
|
mNetService->stampMsgServerUpdateTS(grpId) ;
|
||||||
|
|
||||||
// add to published to allow acknowledgement
|
// add to published to allow acknowledgement
|
||||||
mMsgNotify.insert(std::make_pair(mit->first, std::make_pair(grpId, msgId)));
|
mMsgNotify.insert(std::make_pair(mit->first, std::make_pair(grpId, msgId)));
|
||||||
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
|
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
|
||||||
|
|
|
@ -595,6 +595,14 @@ public:
|
||||||
*/
|
*/
|
||||||
void setGroupReputationCutOff(uint32_t& token, const RsGxsGroupId& grpId, int CutOff);
|
void setGroupReputationCutOff(uint32_t& token, const RsGxsGroupId& grpId, int CutOff);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
*
|
||||||
|
* @param token value set to be redeemed with acknowledgement
|
||||||
|
* @param grpId group id of the group to update
|
||||||
|
* @param CutOff The cut off value to set
|
||||||
|
*/
|
||||||
|
void updateGroupLastMsgTimeStamp(uint32_t& token, const RsGxsGroupId& grpId);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @return storage time of messages in months
|
* @return storage time of messages in months
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -761,11 +761,11 @@ void RsGxsNetService::syncWithPeers()
|
||||||
msg->updateTS = updateTS;
|
msg->updateTS = updateTS;
|
||||||
|
|
||||||
if(encrypt_to_this_circle_id.isNull())
|
if(encrypt_to_this_circle_id.isNull())
|
||||||
msg->grpId = grpId;
|
msg->grpId = grpId;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg->grpId = hashGrpId(grpId,mNetMgr->getOwnId()) ;
|
msg->grpId = hashGrpId(grpId,mNetMgr->getOwnId()) ;
|
||||||
msg->flag |= RsNxsSyncMsgReqItem::FLAG_USE_HASHED_GROUP_ID ;
|
msg->flag |= RsNxsSyncMsgReqItem::FLAG_USE_HASHED_GROUP_ID ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NXS_NET_DEBUG_7
|
#ifdef NXS_NET_DEBUG_7
|
||||||
|
@ -2096,14 +2096,16 @@ void RsGxsNetService::updateServerSyncTS()
|
||||||
else
|
else
|
||||||
msui = mapIT->second;
|
msui = mapIT->second;
|
||||||
|
|
||||||
if(grpMeta->mLastPost > msui->msgUpdateTS )
|
// (cyril) I'm removing this, becuse mLastPost is *never* updated. So this code it not useful at all.
|
||||||
{
|
//
|
||||||
change = true;
|
// if(grpMeta->mLastPost > msui->msgUpdateTS )
|
||||||
msui->msgUpdateTS = grpMeta->mLastPost;
|
// {
|
||||||
|
// change = true;
|
||||||
|
// msui->msgUpdateTS = grpMeta->mLastPost;
|
||||||
#ifdef NXS_NET_DEBUG_0
|
#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
|
#endif
|
||||||
}
|
// }
|
||||||
|
|
||||||
// This is needed for group metadata updates to actually propagate: only a new grpUpdateTS will trigger the exchange of groups mPublishTs which
|
// 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
|
// will then be compared and pssibly trigger a MetaData transmission. mRecvTS is upated when creating, receiving for the first time, or receiving
|
||||||
|
@ -2123,6 +2125,7 @@ void RsGxsNetService::updateServerSyncTS()
|
||||||
if(change)
|
if(change)
|
||||||
IndicateConfigChanged();
|
IndicateConfigChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsGxsNetService::locked_checkTransacTimedOut(NxsTransaction* tr)
|
bool RsGxsNetService::locked_checkTransacTimedOut(NxsTransaction* tr)
|
||||||
{
|
{
|
||||||
return tr->mTimeOut < ((uint32_t) time(NULL));
|
return tr->mTimeOut < ((uint32_t) time(NULL));
|
||||||
|
@ -4891,3 +4894,22 @@ bool RsGxsNetService::getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& gro
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RsGxsNetService::stampMsgServerUpdateTS(const RsGxsGroupId& gid)
|
||||||
|
{
|
||||||
|
RS_STACK_MUTEX(mNxsMutex) ;
|
||||||
|
|
||||||
|
std::map<RsGxsGroupId,RsGxsServerMsgUpdateItem*>::iterator it = mServerMsgUpdateMap.find(gid) ;
|
||||||
|
|
||||||
|
if(mServerMsgUpdateMap.end() == it)
|
||||||
|
{
|
||||||
|
RsGxsServerMsgUpdateItem *item = new RsGxsServerMsgUpdateItem(mServType);
|
||||||
|
item->grpId = gid ;
|
||||||
|
item->msgUpdateTS = time(NULL) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
it->second->msgUpdateTS = time(NULL) ;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,7 @@ public:
|
||||||
virtual void rejectMessage(const RsGxsMessageId& msg_id) ;
|
virtual void rejectMessage(const RsGxsMessageId& msg_id) ;
|
||||||
|
|
||||||
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) ;
|
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) ;
|
||||||
|
virtual bool stampMsgServerUpdateTS(const RsGxsGroupId& gid) ;
|
||||||
|
|
||||||
/* p3Config methods */
|
/* p3Config methods */
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -144,6 +144,15 @@ public:
|
||||||
* \return false if the group is not found, true otherwise
|
* \return false if the group is not found, true otherwise
|
||||||
*/
|
*/
|
||||||
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) =0;
|
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) =0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief stampMsgServerUpdateTS
|
||||||
|
* Updates the msgServerUpdateMap structure to time(NULL), so as to trigger sending msg lists to friends.
|
||||||
|
* This is needed when e.g. posting a new message to a group.
|
||||||
|
* \param gid the group to stamp in msgServerUpdateMap
|
||||||
|
* \return
|
||||||
|
*/
|
||||||
|
virtual bool stampMsgServerUpdateTS(const RsGxsGroupId& gid) =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RSGNP_H
|
#endif // RSGNP_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue