From c4b0d0caf6dfd06423652bb0c0c5f98843aabc09 Mon Sep 17 00:00:00 2001 From: Christian Hofstaedtler Date: Sun, 15 Feb 2015 15:01:28 +0100 Subject: [PATCH] Replace PacketHandler with UeberBackend where possible Makes reasoning about PacketHandler usage easier. --- pdns/dynhandler.cc | 12 ++++++------ pdns/mastercommunicator.cc | 6 +++--- pdns/slavecommunicator.cc | 14 ++++++-------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/pdns/dynhandler.cc b/pdns/dynhandler.cc index a33008944a27..c070dd8c513b 100644 --- a/pdns/dynhandler.cc +++ b/pdns/dynhandler.cc @@ -230,8 +230,8 @@ string DLNotifyRetrieveHandler(const vector&parts, Utility::pid_t ppid) const string& domain=parts[1]; DomainInfo di; - PacketHandler P; - if(!P.getBackend()->getDomainInfo(domain, di)) + UeberBackend B; + if(!B.getDomainInfo(domain, di)) return "Domain '"+domain+"' unknown"; if(di.masters.empty()) @@ -299,11 +299,11 @@ string DLNotifyHandler(const vector&parts, Utility::pid_t ppid) string DLRediscoverHandler(const vector&parts, Utility::pid_t ppid) { - PacketHandler P; + UeberBackend B; try { L<rediscover(&status); + B.rediscover(&status); return status; } catch(PDNSException &ae) { @@ -314,8 +314,8 @@ string DLRediscoverHandler(const vector&parts, Utility::pid_t ppid) string DLReloadHandler(const vector&parts, Utility::pid_t ppid) { - PacketHandler P; - P.getBackend()->reload(); + UeberBackend B; + B.reload(); L<getDomainInfo(domain, di)) { + UeberBackend B; + if(!B.getDomainInfo(domain, di)) { L<setNotified(di.id, di.serial); diff --git a/pdns/slavecommunicator.cc b/pdns/slavecommunicator.cc index 80b3ad35893c..542c41d2176e 100644 --- a/pdns/slavecommunicator.cc +++ b/pdns/slavecommunicator.cc @@ -65,17 +65,15 @@ void CommunicatorClass::addSuckRequest(const string &domain, const string &maste void CommunicatorClass::suck(const string &domain,const string &remote) { L<(P.getBackend()); // copy of the same UeberBackend - DNSSECKeeper dk (B); // reuse our UeberBackend copy for DNSSECKeeper + DNSSECKeeper dk (&B); // reuse our UeberBackend copy for DNSSECKeeper - - if(!B->getDomainInfo(domain, di) || !di.backend) { // di.backend and B are mostly identical + if(!B.getDomainInfo(domain, di) || !di.backend) { // di.backend and B are mostly identical L<getTSIGKey(tsigkeyname, &tsigalgorithm, &tsigsecret64)) { + if(B.getTSIGKey(tsigkeyname, &tsigalgorithm, &tsigsecret64)) { B64Decode(tsigsecret64, tsigsecret); } else { L< pdl; vector scripts; - if(B->getDomainMetadata(domain, "LUA-AXFR-SCRIPT", scripts) && !scripts.empty()) { + if(B.getDomainMetadata(domain, "LUA-AXFR-SCRIPT", scripts) && !scripts.empty()) { try { pdl.reset(new AuthLua(scripts[0])); L< localaddr; ComboAddress laddr; - if(B->getDomainMetadata(domain, "AXFR-SOURCE", localaddr) && !localaddr.empty()) { + if(B.getDomainMetadata(domain, "AXFR-SOURCE", localaddr) && !localaddr.empty()) { try { laddr = ComboAddress(localaddr[0]); L<