fixed deadlock in old identity cleaning. There is still a bug to catch so the cleaning code is currently disabled (but RS will print info about deletion)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8133 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-04-14 16:56:02 +00:00
parent e52976b3e6
commit b0b986efff

View File

@ -150,7 +150,7 @@ p3IdService::p3IdService(RsGeneralDataService *gds, RsNetworkExchangeService *ne
{ {
mBgSchedule_Mode = 0; mBgSchedule_Mode = 0;
mBgSchedule_Active = false; mBgSchedule_Active = false;
mLastKeyCleaningTime = time(NULL) ; mLastKeyCleaningTime = 0 ;
mLastConfigUpdate = 0 ; mLastConfigUpdate = 0 ;
// Kick off Cache Testing, + Others. // Kick off Cache Testing, + Others.
@ -270,17 +270,19 @@ void p3IdService::cleanUnusedKeys()
time_t now = time(NULL) ; time_t now = time(NULL) ;
for(std::map<RsGxsId,time_t>::iterator it(mKeysTS.begin());it!=mKeysTS.end();) for(std::map<RsGxsId,time_t>::iterator it(mKeysTS.begin());it!=mKeysTS.end();)
if(it->second + MAX_KEEP_UNUSED_KEYS < now && !isOwnId(it->first)) if(it->second + MAX_KEEP_UNUSED_KEYS < now
&& std::find(mOwnIds.begin(),mOwnIds.end(),it->first) == mOwnIds.end())
{ {
std::cerr << "Deleting identity " << it->first << " which is too old." << std::endl; std::cerr << "Deleting identity " << it->first << " which is too old." << std::endl;
uint32_t token ; uint32_t token ;
RsGxsIdGroup group; RsGxsIdGroup group;
group.mMeta.mGroupId=RsGxsGroupId(it->first); group.mMeta.mGroupId=RsGxsGroupId(it->first);
rsIdentity->deleteIdentity(token, group); //rsIdentity->deleteIdentity(token, group);
std::map<RsGxsId,time_t>::iterator tmp = it ; std::map<RsGxsId,time_t>::iterator tmp = it ;
++tmp ; ++tmp ;
mKeysTS.erase(it) ; //mKeysTS.erase(it) ;
it = tmp ;
} }
else else
++it ; ++it ;