Add a build-time switch to set whether GXS distributes all available data or only sends data withint the configured sync period.

This commit is contained in:
sehraf 2018-11-05 11:00:32 +01:00 committed by csoler
parent d711e09b68
commit 66dff9bf0b
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
2 changed files with 12 additions and 1 deletions

View file

@ -4382,7 +4382,9 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
rstime_t now = time(NULL) ;
#ifndef RS_GXS_SEND_ALL
uint32_t max_send_delay = locked_getGrpConfig(item->grpId).msg_req_delay; // we should use "sync" but there's only one variable used in the GUI: the req one.
#endif
if(canSendMsgIds(msgMetas, *grpMeta, peer, should_encrypt_to_this_circle_id))
{
@ -4413,8 +4415,11 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
}
}
// Check publish TS
#ifndef RS_GXS_SEND_ALL
if(item->createdSinceTS > (*vit)->mPublishTs || ((max_send_delay > 0) && (*vit)->mPublishTs + max_send_delay < now))
#else
if(item->createdSinceTS > (*vit)->mPublishTs)
#endif
{
#ifdef NXS_NET_DEBUG_0
GXSNETDEBUG_PG(item->PeerId(),item->grpId) << " not sending item ID " << (*vit)->mMsgId << ", because it is too old (publishTS = " << (time(NULL)-(*vit)->mPublishTs)/86400 << " days ago" << std::endl;