summaryrefslogtreecommitdiff
path: root/src/dnsqueue.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-13 21:33:57 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-13 21:33:57 +0000
commit1a95ce0b2b6f19780d274748594964a57e6ede53 (patch)
tree91906145b716c2b191efd4dcf740b9d899f5505a /src/dnsqueue.cpp
parentd068c30e679b096d70cfbdc6f278ff45569beb2f (diff)
Optimized accept() stuff to eliminate loop, idea while talking to w00t
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2381 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/dnsqueue.cpp')
-rw-r--r--src/dnsqueue.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/dnsqueue.cpp b/src/dnsqueue.cpp
index 2d123a419..78be4d8f1 100644
--- a/src/dnsqueue.cpp
+++ b/src/dnsqueue.cpp
@@ -98,9 +98,11 @@ public:
strlcpy(u,nick.c_str(),NICKMAX);
/* ASSOCIATE WITH DNS LOOKUP LIST */
- dnslist[resolver1.GetFD()] = this;
-
- return true;
+ if (resolver1.GetFD() != -1)
+ {
+ dnslist[resolver1.GetFD()] = this;
+ return true;
+ }
}
return false;
}
@@ -157,7 +159,11 @@ public:
{
usr = Find(u);
if ((usr) && (usr->dns_done))
+ {
+ if (resolver1.GetFD() != -1)
+ dnslist[resolver1.GetFD()] = NULL;
return true;
+ }
if (resolver1.GetFD() != -1)
{
dnslist[resolver1.GetFD()] = NULL;
@@ -173,7 +179,7 @@ public:
if (hostname != "")
{
resolver2.ForwardLookup(hostname);
- if (resolver2.GetFD())
+ if (resolver2.GetFD() != -1)
dnslist[resolver2.GetFD()] = this;
}
}
@@ -258,6 +264,10 @@ void dns_poll(int fdcheck)
*/
return;
}
- log(DEBUG,"DNS: Received an event for an invalid descriptor!");
+ /* This FD doesnt belong here, lets be rid of it,
+ * just to be safe so we dont get any more events
+ * about it.
+ */
+ SE->DelFd(fdcheck);
}