X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=xmltooling%2Fsignature%2Fimpl%2FInlineKeyResolver.cpp;h=8a4ffcf08764e77665b1004f655414d97a37c46e;hb=9016e029ebf6af8030fe3d42a4cee2c32f39ee44;hp=c34db20f01b9306060b60a9dbe9153421f6c8cb8;hpb=399d8e3f9ac4abd5ad5f0fbdea48973c622339b0;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/signature/impl/InlineKeyResolver.cpp b/xmltooling/signature/impl/InlineKeyResolver.cpp index c34db20..8a4ffcf 100644 --- a/xmltooling/signature/impl/InlineKeyResolver.cpp +++ b/xmltooling/signature/impl/InlineKeyResolver.cpp @@ -21,7 +21,7 @@ */ #include "internal.h" -#include "signature/KeyResolver.h" +#include "signature/CachingKeyResolver.h" #include "util/NDC.h" #include "util/Threads.h" @@ -42,7 +42,7 @@ using namespace log4cpp; using namespace std; namespace xmlsignature { - class XMLTOOL_DLLLOCAL InlineKeyResolver : public KeyResolver + class XMLTOOL_DLLLOCAL InlineKeyResolver : public CachingKeyResolver { public: InlineKeyResolver(const DOMElement* e); @@ -53,6 +53,14 @@ namespace xmlsignature { vector::size_type resolveCertificates(const KeyInfo* keyInfo, vector& certs) const; vector::size_type resolveCertificates(DSIGKeyInfoList* keyInfo, vector& certs) const; + void clearCache() { + if (m_lock) + m_lock->wrlock(); + m_cache.clear(); + if (m_lock) + m_lock->unlock(); + } + private: struct XMLTOOL_DLLLOCAL CacheEntry { CacheEntry() : m_key(NULL) {} @@ -89,7 +97,7 @@ InlineKeyResolver::InlineKeyResolver(const DOMElement* e) : m_lock(NULL) InlineKeyResolver::~InlineKeyResolver() { - m_cache.clear(); + clearCache(); delete m_lock; }