Skip to content

Commit

Permalink
api: use uncached results for getKeys()
Browse files Browse the repository at this point in the history
  • Loading branch information
mind04 committed Dec 22, 2014
1 parent c574336 commit 8f35ba2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pdns/dbdnsseckeeper.cc
Expand Up @@ -294,15 +294,15 @@ bool DNSSECKeeper::unsetPresigned(const std::string& zname)
}


DNSSECKeeper::keyset_t DNSSECKeeper::getKeys(const std::string& zone, boost::tribool allOrKeyOrZone)
DNSSECKeeper::keyset_t DNSSECKeeper::getKeys(const std::string& zone, boost::tribool allOrKeyOrZone, bool useCache)
{
unsigned int now = time(0);

if(!((++s_ops) % 100000)) {
cleanup();
}

{
if (useCache) {
ReadLock l(&s_keycachelock);
keycache_t::const_iterator iter = s_keycache.find(zone);

Expand Down
2 changes: 1 addition & 1 deletion pdns/dnsseckeeper.hh
Expand Up @@ -71,7 +71,7 @@ public:
}
bool isSecuredZone(const std::string& zone);

keyset_t getKeys(const std::string& zone, boost::tribool allOrKeyOrZone = boost::indeterminate);
keyset_t getKeys(const std::string& zone, boost::tribool allOrKeyOrZone = boost::indeterminate, bool useCache = true);
DNSSECPrivateKey getKeyById(const std::string& zone, unsigned int id);
bool addKey(const std::string& zname, bool keyOrZone, int algorithm=5, int bits=0, bool active=true);
bool addKey(const std::string& zname, const DNSSECPrivateKey& dpk, bool active=true);
Expand Down
2 changes: 1 addition & 1 deletion pdns/ws-auth.cc
Expand Up @@ -492,7 +492,7 @@ static void apiZoneCryptokeys(HttpRequest* req, HttpResponse* resp) {
if(!dk.isSecuredZone(zonename))
throw ApiException("Zone '"+zonename+"' is not secured");

DNSSECKeeper::keyset_t keyset=dk.getKeys(zonename);
DNSSECKeeper::keyset_t keyset=dk.getKeys(zonename, boost::indeterminate, false);

if (keyset.empty())
throw ApiException("No keys for zone '"+zonename+"'");
Expand Down

0 comments on commit 8f35ba2

Please sign in to comment.