diff options
Diffstat (limited to 'src/dns.cpp')
-rw-r--r-- | src/dns.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/dns.cpp b/src/dns.cpp index 9d67d5c12..3c4701ed6 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -40,8 +40,7 @@ using namespace std; #include "socketengine.h" extern SocketEngine* SE; - -extern int statsAccept,statsRefused,statsUnknown,statsCollisions,statsDns,statsDnsGood,statsDnsBad,statsConnects,statsSent,statsRecv; +serverstats* stats; #define max(a,b) (a > b ? a : b) #define DNS_MAX 8 /* max number of nameservers used */ @@ -655,7 +654,7 @@ DNS::~DNS() bool DNS::ReverseLookup(std::string ip) { - statsDns++; + stats->statsDns++; binip = dns_aton4(ip.c_str()); if (binip == NULL) { return false; @@ -675,7 +674,7 @@ bool DNS::ReverseLookup(std::string ip) bool DNS::ForwardLookup(std::string host) { - statsDns++; + stats->statsDns++; this->myfd = dns_getip4(host.c_str()); if (this->myfd == -1) { @@ -721,11 +720,11 @@ std::string DNS::GetResult() SE->DelFd(this->myfd); #endif if (result) { - statsDnsGood++; + stats->statsDnsGood++; dns_close(this->myfd); return result; } else { - statsDnsBad++; + stats->statsDnsBad++; if (this->myfd != -1) { dns_close(this->myfd); @@ -748,7 +747,7 @@ std::string DNS::GetResultIP() } if (result) { - statsDnsGood++; + stats->statsDnsGood++; unsigned char a = (unsigned)result[0]; unsigned char b = (unsigned)result[1]; unsigned char c = (unsigned)result[2]; @@ -758,7 +757,7 @@ std::string DNS::GetResultIP() } else { - statsDnsBad++; + stats->statsDnsBad++; log(DEBUG,"DANGER WILL ROBINSON! NXDOMAIN for forward lookup, but we got a reverse lookup!"); return ""; } |