mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-02 19:26:31 -04:00
First stage in abstracting GXS identities usage cases (half done)
This commit is contained in:
parent
f8ac391a28
commit
17fc89e3c0
7 changed files with 54 additions and 21 deletions
|
@ -263,14 +263,16 @@ time_t p3IdService::locked_getLastUsageTS(const RsGxsId& gxs_id)
|
|||
else
|
||||
return it->second.TS ;
|
||||
}
|
||||
void p3IdService::timeStampKey(const RsGxsId& gxs_id, const std::string& reason)
|
||||
void p3IdService::timeStampKey(const RsGxsId& gxs_id, const RsIdentityUsage& reason)
|
||||
{
|
||||
if(rsReputations->isIdentityBanned(gxs_id) )
|
||||
{
|
||||
std::cerr << "(II) p3IdService:timeStampKey(): refusing to time stamp key " << gxs_id << " because it is banned." << std::endl;
|
||||
return ;
|
||||
}
|
||||
#ifdef DEBUG_IDS
|
||||
std::cerr << "(II) time stamping key " << gxs_id << " for the following reason: " << reason << std::endl;
|
||||
#endif
|
||||
|
||||
RS_STACK_MUTEX(mIdMtx) ;
|
||||
|
||||
|
@ -786,7 +788,7 @@ static void mergeIds(std::map<RsGxsId,std::list<RsPeerId> >& idmap,const RsGxsId
|
|||
old_peers.push_back(*it) ;
|
||||
}
|
||||
|
||||
bool p3IdService::requestKey(const RsGxsId &id, const std::list<RsPeerId>& peers,const std::string& info)
|
||||
bool p3IdService::requestKey(const RsGxsId &id, const std::list<RsPeerId>& peers,const RsIdentityUsage& info)
|
||||
{
|
||||
if(id.isNull())
|
||||
{
|
||||
|
@ -2262,6 +2264,9 @@ bool p3IdService::cache_load_for_token(uint32_t token)
|
|||
for(std::map<RsGxsId,std::list<RsPeerId> >::const_iterator itt(mPendingCache.begin());itt!=mPendingCache.end();++itt)
|
||||
if(!itt->second.empty())
|
||||
mergeIds(mIdsNotPresent,itt->first,itt->second) ;
|
||||
else
|
||||
std::cerr << "(WW) empty list of peers to request ID " << itt->first << ": cannot request" << std::endl;
|
||||
|
||||
|
||||
mPendingCache.clear();
|
||||
|
||||
|
|
|
@ -212,7 +212,6 @@ private:
|
|||
void init(const RsGxsIdGroupItem *item, const RsTlvPublicRSAKey& in_pub_key, const RsTlvPrivateRSAKey& in_priv_key,const std::list<RsRecognTag> &tagList);
|
||||
};
|
||||
|
||||
|
||||
// Not sure exactly what should be inherited here?
|
||||
// Chris - please correct as necessary.
|
||||
|
||||
|
@ -298,7 +297,7 @@ public:
|
|||
virtual bool getKey(const RsGxsId &id, RsTlvPublicRSAKey &key);
|
||||
virtual bool getPrivateKey(const RsGxsId &id, RsTlvPrivateRSAKey &key);
|
||||
|
||||
virtual bool requestKey(const RsGxsId &id, const std::list<RsPeerId> &peers, const std::string &info);
|
||||
virtual bool requestKey(const RsGxsId &id, const std::list<RsPeerId> &peers, const RsIdentityUsage &info);
|
||||
virtual bool requestPrivateKey(const RsGxsId &id);
|
||||
|
||||
|
||||
|
@ -467,7 +466,7 @@ private:
|
|||
void cleanUnusedKeys() ;
|
||||
void slowIndicateConfigChanged() ;
|
||||
|
||||
virtual void timeStampKey(const RsGxsId& id,const std::string& reason) ;
|
||||
virtual void timeStampKey(const RsGxsId& id, const RsIdentityUsage& reason) ;
|
||||
time_t locked_getLastUsageTS(const RsGxsId& gxs_id);
|
||||
|
||||
std::string genRandomId(int len = 20);
|
||||
|
@ -512,7 +511,7 @@ private:
|
|||
keyTSInfo() : TS(0) {}
|
||||
|
||||
time_t TS ;
|
||||
std::map<std::string,time_t> usage_map ;
|
||||
std::map<RsIdentityUsage,time_t> usage_map ;
|
||||
};
|
||||
friend class IdCacheEntryCleaner;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue