From aec222dff3f57868841288b00c00dad70df9c110 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 14 Mar 2018 18:24:30 +0100 Subject: [PATCH] dnsdist: Don't keep track of the remote in StatNode We don't use them (they are not even available from Lua) and it becomes very painful when you have a lot of different remotes in the ring buffers. --- pdns/statnode.cc | 6 +++--- pdns/statnode.hh | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pdns/statnode.cc b/pdns/statnode.cc index d33836438..358e22036 100644 --- a/pdns/statnode.cc +++ b/pdns/statnode.cc @@ -39,10 +39,10 @@ void StatNode::visit(visitor_t visitor, Stat &newstat, unsigned int depth) cons childstat.nxdomains += s.nxdomains; childstat.servfails += s.servfails; childstat.drops += s.drops; - childstat.remotes = s.remotes; +// childstat.remotes = s.remotes; - Stat selfstat(childstat); + Stat selfstat(childstat); for(const children_t::value_type& child : children) { child.second.visit(visitor, childstat, depth+8); @@ -107,7 +107,7 @@ void StatNode::submit(deque& labels, const std::string& domain, int rcod s.servfails++; else if(rcode==3) s.nxdomains++; - s.remotes[remote]++; +// s.remotes[remote]++; } else { if (fullname.empty()) { diff --git a/pdns/statnode.hh b/pdns/statnode.hh index 26759fd2c..beea6c8d3 100644 --- a/pdns/statnode.hh +++ b/pdns/statnode.hh @@ -29,7 +29,7 @@ class StatNode { public: - struct Stat + struct Stat { Stat() : queries(0), noerrors(0), nxdomains(0), servfails(0), drops(0){} int queries, noerrors, nxdomains, servfails, drops; @@ -41,13 +41,13 @@ public: servfails+=rhs.servfails; drops+=rhs.drops; - for(const remotes_t::value_type& rem : rhs.remotes) { - remotes[rem.first]+=rem.second; - } + //for(const remotes_t::value_type& rem : rhs.remotes) { + // remotes[rem.first]+=rem.second; + //} return *this; } - typedef std::map remotes_t; - remotes_t remotes; + //typedef std::map remotes_t; + //remotes_t remotes; }; Stat s; @@ -56,12 +56,13 @@ public: unsigned int labelsCount{0}; void submit(const DNSName& domain, int rcode, const ComboAddress& remote); - void submit(std::deque& labels, const std::string& domain, int rcode, const ComboAddress& remote, unsigned int count); Stat print(unsigned int depth=0, Stat newstat=Stat(), bool silent=false) const; typedef boost::function visitor_t; void visit(visitor_t visitor, Stat& newstat, unsigned int depth=0) const; typedef std::map children_t; children_t children; - + +private: + void submit(std::deque& labels, const std::string& domain, int rcode, const ComboAddress& remote, unsigned int count); }; -- 2.40.0