summaryrefslogtreecommitdiff
path: root/src/dns.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-16 09:56:33 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-16 09:56:33 +0000
commit898e8da56573c70524a926c1df5dbab7ffcca6a5 (patch)
treec39386855aacfb719554af7cb3afe0d3c62e59b4 /src/dns.cpp
parent7cf8d9c1c8ba68419d282e715b7fc3575987a6f2 (diff)
Moved command parsing crap into command_parse.cpp
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2505 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/dns.cpp')
-rw-r--r--src/dns.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index 5a70bb41d..d8018656e 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -764,3 +764,45 @@ std::string DNS::GetResultIP()
}
}
+
+
+#ifdef THREADED_DNS
+void* dns_task(void* arg)
+{
+ userrec* u = (userrec*)arg;
+ log(DEBUG,"DNS thread for user %s",u->nick);
+ DNS dns1;
+ DNS dns2;
+ std::string host;
+ std::string ip;
+ if (dns1.ReverseLookup(u->ip))
+ {
+ while (!dns1.HasResult())
+ {
+ usleep(100);
+ }
+ host = dns1.GetResult();
+ if (host != "")
+ {
+ if (dns2.ForwardLookup(host))
+ {
+ while (!dns2.HasResult())
+ {
+ usleep(100);
+ }
+ ip = dns2.GetResultIP();
+ if (ip == std::string(u->ip))
+ {
+ if (host.length() < 160)
+ {
+ strcpy(u->host,host.c_str());
+ strcpy(u->dhost,host.c_str());
+ }
+ }
+ }
+ }
+ }
+ u->dns_done = true;
+ return NULL;
+}
+#endif