aboutsummaryrefslogtreecommitdiffstats
path: root/src/dns.cpp
diff options
context:
space:
mode:
authorGravatar brain2005-12-12 12:44:43 +0000
committerGravatar brain2005-12-12 12:44:43 +0000
commit280f52aeae72a3383e1e10b2f2a5952e7b1413b7 (patch)
treef2be3394b53fe6bb4fac93d5b74e2b839698d61c /src/dns.cpp
parentMore experimental gubbins (diff)
downloadinspircd++-280f52aeae72a3383e1e10b2f2a5952e7b1413b7.tar.gz
inspircd++-280f52aeae72a3383e1e10b2f2a5952e7b1413b7.tar.bz2
inspircd++-280f52aeae72a3383e1e10b2f2a5952e7b1413b7.zip
*EXPERIMENTAL* Tied DNS into new socket engine
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2331 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/dns.cpp')
-rw-r--r--src/dns.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index 88b5d399c..a0e36e600 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -37,6 +37,9 @@ using namespace std;
#include <arpa/inet.h>
#include "dns.h"
#include "helperfuncs.h"
+#include "socketengine.h"
+
+extern SocketEngine* SE;
extern int statsAccept,statsRefused,statsUnknown,statsCollisions,statsDns,statsDnsGood,statsDnsBad,statsConnects,statsSent,statsRecv;
@@ -664,6 +667,9 @@ bool DNS::ReverseLookup(std::string ip)
return false;
}
log(DEBUG,"DNS: ReverseLookup, fd=%d",this->myfd);
+#ifndef THREADED_DNS
+ SE->AddFd(this->myfd,true,X_ESTAB_DNS);
+#endif
return true;
}
@@ -676,6 +682,9 @@ bool DNS::ForwardLookup(std::string host)
return false;
}
log(DEBUG,"DNS: ForwardLookup, fd=%d",this->myfd);
+#ifndef THREADED_DNS
+ SE->AddFd(this->myfd,true,X_ESTAB_DNS);
+#endif
return true;
}
@@ -699,6 +708,9 @@ std::string DNS::GetResult()
{
log(DEBUG,"DNS: GetResult()");
result = dns_getresult(this->myfd);
+#ifndef THREADED_DNS
+ SE->DelFd(this->myfd);
+#endif
if (result) {
statsDnsGood++;
dns_close(this->myfd);
@@ -720,6 +732,9 @@ std::string DNS::GetResultIP()
result = dns_getresult(this->myfd);
if (this->myfd != -1)
{
+#ifndef THREADED_DNS
+ SE->DelFd(this->myfd);
+#endif
dns_close(this->myfd);
}
if (result)