mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
slowed down config saving in p3idservice
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8022 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
502b34dff4
commit
553240cda9
@ -120,6 +120,7 @@ RsIdentity *rsIdentity = NULL;
|
||||
/* delays */
|
||||
|
||||
#define CACHETEST_PERIOD 60
|
||||
#define DELAY_BETWEEN_CONFIG_UPDATES 300
|
||||
|
||||
#define OWNID_RELOAD_DELAY 10
|
||||
|
||||
@ -150,6 +151,7 @@ p3IdService::p3IdService(RsGeneralDataService *gds, RsNetworkExchangeService *ne
|
||||
mBgSchedule_Mode = 0;
|
||||
mBgSchedule_Active = false;
|
||||
mLastKeyCleaningTime = time(NULL) ;
|
||||
mLastConfigUpdate = 0 ;
|
||||
|
||||
// Kick off Cache Testing, + Others.
|
||||
RsTickEvent::schedule_in(GXSID_EVENT_PGPHASH, PGPHASH_PERIOD);
|
||||
@ -206,13 +208,23 @@ uint32_t p3IdService::idAuthenPolicy()
|
||||
|
||||
return policy;
|
||||
}
|
||||
void p3IdService::slowIndicateConfigChanged()
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
|
||||
if(mLastConfigUpdate + DELAY_BETWEEN_CONFIG_UPDATES < now)
|
||||
{
|
||||
IndicateConfigChanged() ;
|
||||
mLastConfigUpdate = now ;
|
||||
}
|
||||
}
|
||||
time_t p3IdService::locked_getLastUsageTS(const RsGxsId& gxs_id)
|
||||
{
|
||||
std::map<RsGxsId,time_t>::const_iterator it = mKeysTS.find(gxs_id) ;
|
||||
|
||||
if(it == mKeysTS.end())
|
||||
{
|
||||
IndicateConfigChanged() ;
|
||||
slowIndicateConfigChanged() ;
|
||||
return mKeysTS[gxs_id] = time(NULL) ;
|
||||
}
|
||||
else
|
||||
@ -224,7 +236,7 @@ void p3IdService::timeStampKey(const RsGxsId& gxs_id)
|
||||
|
||||
mKeysTS[gxs_id] = time(NULL) ;
|
||||
|
||||
IndicateConfigChanged() ;
|
||||
slowIndicateConfigChanged() ;
|
||||
}
|
||||
|
||||
bool p3IdService::loadList(std::list<RsItem*>& items)
|
||||
|
@ -455,6 +455,8 @@ virtual void generateDummyData();
|
||||
void generateDummy_UnknownPseudo();
|
||||
|
||||
void cleanUnusedKeys() ;
|
||||
void slowIndicateConfigChanged() ;
|
||||
|
||||
virtual void timeStampKey(const RsGxsId& id) ;
|
||||
time_t locked_getLastUsageTS(const RsGxsId& gxs_id);
|
||||
|
||||
@ -509,6 +511,7 @@ std::string genRandomId(int len = 20);
|
||||
PgpAuxUtils *mPgpUtils;
|
||||
|
||||
time_t mLastKeyCleaningTime ;
|
||||
time_t mLastConfigUpdate ;
|
||||
};
|
||||
|
||||
#endif // P3_IDENTITY_SERVICE_HEADER
|
||||
|
Loading…
Reference in New Issue
Block a user