if (seconds && c.when < cutoff)
continue;
- root.submit(c.name, c.dh.rcode, c.requestor);
+ root.submit(c.name, c.dh.rcode, boost::none);
}
}
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;
for(const children_t::value_type& child : children) {
child.second.visit(visitor, childstat, depth+8);
}
-void StatNode::submit(const DNSName& domain, int rcode, const ComboAddress& remote)
+void StatNode::submit(const DNSName& domain, int rcode, boost::optional<const ComboAddress&> remote)
{
// cerr<<"FIRST submit called on '"<<domain<<"'"<<endl;
std::vector<string> tmp = domain.getRawLabels();
www.powerdns.com.
*/
-void StatNode::submit(std::vector<string>::const_iterator end, std::vector<string>::const_iterator begin, const std::string& domain, int rcode, const ComboAddress& remote, unsigned int count)
+void StatNode::submit(std::vector<string>::const_iterator end, std::vector<string>::const_iterator begin, const std::string& domain, int rcode, boost::optional<const ComboAddress&> remote, unsigned int count)
{
// cerr<<"Submit called for domain='"<<domain<<"': ";
// for(const std::string& n : labels)
s.servfails++;
else if(rcode==3)
s.nxdomains++;
-// s.remotes[remote]++;
+
+ if (remote) {
+ s.remotes[*remote]++;
+ }
}
else {
if (fullname.empty()) {
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;
std::string fullname;
unsigned int labelsCount{0};
- void submit(const DNSName& domain, int rcode, const ComboAddress& remote);
+ void submit(const DNSName& domain, int rcode, boost::optional<const ComboAddress&> remote);
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;
children_t children;
private:
- void submit(std::vector<string>::const_iterator end, std::vector<string>::const_iterator begin, const std::string& domain, int rcode, const ComboAddress& remote, unsigned int count);
+ void submit(std::vector<string>::const_iterator end, std::vector<string>::const_iterator begin, const std::string& domain, int rcode, boost::optional<const ComboAddress&> remote, unsigned int count);
};