]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Don't keep track of the remote in StatNode
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 14 Mar 2018 17:24:30 +0000 (18:24 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 14 Mar 2018 17:24:30 +0000 (18:24 +0100)
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
pdns/statnode.hh

index d33836438328623c7dbc635be86d1759e0eb2ac4..358e220368c065779ee8a271d6a1007b3cd8b734 100644 (file)
@@ -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<string>& 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()) {
index 26759fd2ce0ceee650b189897850c3049ab13f26..beea6c8d314b2280fa1b39d8dd0cc9019e1fede5 100644 (file)
@@ -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<ComboAddress,int,ComboAddress::addressOnlyLessThan> remotes_t;
-    remotes_t remotes;
+    //typedef std::map<ComboAddress,int,ComboAddress::addressOnlyLessThan> 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<std::string>& 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<void(const StatNode*, const Stat& selfstat, const Stat& childstat)> visitor_t;
   void visit(visitor_t visitor, Stat& newstat, unsigned int depth=0) const;
   typedef std::map<std::string,StatNode, CIStringCompare> children_t;
   children_t children;
-  
+
+private:
+  void submit(std::deque<std::string>& labels, const std::string& domain, int rcode, const ComboAddress& remote, unsigned int count);
 };