From 3cfd6afa608215633f8560fffd3d5abf86fb5b87 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 4 Dec 2016 23:26:48 +0100 Subject: [PATCH] added entry in rsgxsnetservice to change sync params --- src/gxs/rsgxsnetservice.cc | 22 ++++++++++++++++++- src/gxs/rsgxsnetservice.h | 8 +++---- src/gxs/rsnxs.h | 5 +++-- .../gxs/gen_exchange/rsdummyservices.h | 3 ++- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/gxs/rsgxsnetservice.cc b/src/gxs/rsgxsnetservice.cc index 19aa1bb4c..66249dac5 100644 --- a/src/gxs/rsgxsnetservice.cc +++ b/src/gxs/rsgxsnetservice.cc @@ -4406,9 +4406,29 @@ void RsGxsNetService::pauseSynchronisation(bool /* enabled */) } -void RsGxsNetService::setSyncAge(uint32_t /* age */) +void RsGxsNetService::setSyncAge(const RsGxsGroupId &grpId, uint32_t age_in_secs) { + RS_STACK_MUTEX(mNxsMutex) ; + RsGxsGrpConfig& conf(mServerGrpConfigMap[grpId]) ; + + if(conf.msg_req_delay != age_in_secs) + { + conf.msg_req_delay = age_in_secs; + IndicateConfigChanged(); + } +} +void RsGxsNetService::setKeepAge(const RsGxsGroupId &grpId, uint32_t age_in_secs) +{ + RS_STACK_MUTEX(mNxsMutex) ; + + RsGxsGrpConfig& conf(mServerGrpConfigMap[grpId]) ; + + if(conf.msg_keep_delay != age_in_secs) + { + conf.msg_keep_delay = age_in_secs; + IndicateConfigChanged(); + } } int RsGxsNetService::requestGrp(const std::list& grpId, const RsPeerId& peerId) diff --git a/src/gxs/rsgxsnetservice.h b/src/gxs/rsgxsnetservice.h index 227dc73eb..28f001de8 100644 --- a/src/gxs/rsgxsnetservice.h +++ b/src/gxs/rsgxsnetservice.h @@ -103,11 +103,11 @@ public: /*! - * Use this to set how far back synchronisation of messages should take place - * @param age the max age a sync item can to be allowed in a synchronisation + * Use this to set how far back synchronisation and storage of messages should take place + * @param age the max age a sync/storage item can to be allowed in a synchronisation */ - // NOT IMPLEMENTED - virtual void setSyncAge(uint32_t age); + virtual void setSyncAge(const RsGxsGroupId& grpId,uint32_t age_in_secs); + virtual void setKeepAge(const RsGxsGroupId& grpId,uint32_t age_in_secs); /*! * pauses synchronisation of subscribed groups and request for group id diff --git a/src/gxs/rsnxs.h b/src/gxs/rsnxs.h index 13eb6fedb..6c4fbba0c 100644 --- a/src/gxs/rsnxs.h +++ b/src/gxs/rsnxs.h @@ -65,9 +65,10 @@ public: /*! * Use this to set how far back synchronisation of messages should take place - * @param age the max age a sync item can to be allowed in a synchronisation + * @param age in seconds the max age a sync/store item can to be allowed in a synchronisation */ - virtual void setSyncAge(uint32_t age) = 0; + virtual void setSyncAge(const RsGxsGroupId& id,uint32_t age_in_secs) = 0; + virtual void setKeepAge(const RsGxsGroupId& id,uint32_t age_in_secs) = 0; /*! * Initiates a search through the network diff --git a/tests/unittests/libretroshare/gxs/gen_exchange/rsdummyservices.h b/tests/unittests/libretroshare/gxs/gen_exchange/rsdummyservices.h index a422cd03f..3bb951410 100644 --- a/tests/unittests/libretroshare/gxs/gen_exchange/rsdummyservices.h +++ b/tests/unittests/libretroshare/gxs/gen_exchange/rsdummyservices.h @@ -15,7 +15,8 @@ public: RsDummyNetService(){ return;} virtual ~RsDummyNetService() { } - void setSyncAge(uint32_t age){} + void setSyncAge(const RsGxsGroupId& id,uint32_t age_in_secs){} + void setKeepAge(const RsGxsGroupId& id,uint32_t age_in_secs){} void requestGroupsOfPeer(const std::string& peerId){}