Added Cache system for GPG Certificates.

- This should reduce gpg calls by 90+%.
Updated rsversion svn to 4942 



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4942 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-02-15 16:44:45 +00:00
parent bdc8a11203
commit e024ea36e9
4 changed files with 113 additions and 38 deletions

View file

@ -83,6 +83,12 @@ class gpgcert
bool accept_connection;
gpgme_key_t key;
// Cached Certificates...
bool mHaveCachedCert;
std::string mCachedCert;
};
class AuthGPGOperation
@ -101,19 +107,21 @@ public:
class AuthGPGOperationLoadOrSave : public AuthGPGOperation
{
public:
AuthGPGOperationLoadOrSave(bool load, const std::string &certGpgOrId, void *userdata) : AuthGPGOperation(userdata)
AuthGPGOperationLoadOrSave(bool load, const std::string &gpgId, const std::string &gpgCert, void *userdata)
: AuthGPGOperation(userdata)
{
m_load = load;
if (m_load) {
m_certGpg = certGpgOrId;
m_certGpg = gpgCert;
m_certGpgId = gpgId;
} else {
m_certGpgId = certGpgOrId;
m_certGpgId = gpgId;
}
}
public:
bool m_load;
std::string m_certGpgId; // set for save
std::string m_certGpgId; // set for save & load.
std::string m_certGpg; // set for load
};
@ -340,6 +348,10 @@ virtual bool isGPGId(const std::string &id);
virtual bool LoadCertificateFromString(const std::string &pem, std::string &gpg_id,std::string& error_string);
virtual std::string SaveCertificateToString(const std::string &id,bool include_signatures) ;
// Cached certificates.
bool cacheGPGCertificate(const std::string &id, const std::string &certificate);
bool getCachedGPGCertificate(const std::string &id, std::string &certificate);
/*********************************************************************************/
/************************* STAGE 6 ***********************************************/
/*********************************************************************************/