summaryrefslogtreecommitdiff
path: root/src/dnsqueue.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-01 19:15:55 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-01 19:15:55 +0000
commitb7f823b059aa6f8133abf0a0d1895983ccd04590 (patch)
tree9e09fa0b2a02ce2380a7069ef18d198c9a22c773 /src/dnsqueue.cpp
parent3ae5210daedc65958799d38dd9eb05a8b5beee6c (diff)
DNS timeout fixes!
Docs to come git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@940 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/dnsqueue.cpp')
-rw-r--r--src/dnsqueue.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/dnsqueue.cpp b/src/dnsqueue.cpp
index ac521f091..4c328e71c 100644
--- a/src/dnsqueue.cpp
+++ b/src/dnsqueue.cpp
@@ -193,13 +193,26 @@ public:
{
if (resolver->HasResult())
{
- log(DEBUG,"DNS Result available!");
- std::string hostname = resolver->GetResult();
- if (u)
+ log(DEBUG,"resolver says result available!");
+ if (resolver->GetFD() != 0)
+ {
+ log(DEBUG,"Resolver FD is not 0");
+ std::string hostname = resolver->GetResult();
+ if (u)
+ {
+ log(DEBUG,"Applying hostname lookup to %s: %s",u->nick,hostname.c_str());
+ if (hostname != "")
+ {
+ strlcpy(u->host,hostname.c_str(),MAXBUF);
+ WriteServ(u->fd,"NOTICE Auth :Resolved your hostname: %s",hostname.c_str());
+ u->dns_done = true;
+ return true;
+ }
+ return false;
+ }
+ }
+ else
{
- log(DEBUG,"Applying hostname lookup to %s: %s",u->nick,hostname.c_str());
- if (hostname != "")
- strlcpy(u->host,hostname.c_str(),MAXBUF);
u->dns_done = true;
return true;
}
@@ -225,6 +238,7 @@ bool lookup_dns(userrec* u)
{
// place a new user into the queue...
log(DEBUG,"Queueing DNS lookup for %s",u->nick);
+ WriteServ(u->fd,"NOTICE Auth :Looking up your hostname...");
Lookup L(u);
dnsq.push_back(L);
return true;
@@ -235,11 +249,9 @@ void dns_poll()
// do we have items in the queue?
if (dnsq.size())
{
- log(DEBUG,"DNS items pending...");
// are any ready, or stale?
if (dnsq[0].Done() || (!dnsq[0].GetFD()))
{
- // if they are take them out...
log(DEBUG,"****** DNS lookup for fd %d is complete. ******",dnsq[0].GetFD());
dnsq.erase(dnsq.begin());
}