summaryrefslogtreecommitdiff
path: root/src/dnsqueue.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-01 23:00:39 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-01 23:00:39 +0000
commit6e08ce6bfd1da11569cbdb78b065f62a19bf56f3 (patch)
treea561d37e2b6fb5420363fdee904b48afad0a3aee /src/dnsqueue.cpp
parent1a12f849b82ffa7d6cab5685c35700b6bda798f1 (diff)
Turned an unstable vector into an array
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@946 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/dnsqueue.cpp')
-rw-r--r--src/dnsqueue.cpp39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/dnsqueue.cpp b/src/dnsqueue.cpp
index cf1fb7484..6d5c37405 100644
--- a/src/dnsqueue.cpp
+++ b/src/dnsqueue.cpp
@@ -158,7 +158,6 @@ extern user_hash clientlist;
extern chan_hash chanlist;
extern user_hash whowas;
extern command_table cmdlist;
-extern address_cache IP;
extern ClassVector Classes;
@@ -175,6 +174,14 @@ public:
resolver = NULL;
}
+ void Reset()
+ {
+ strcpy(u,"");
+ if (resolver)
+ delete resolver;
+ resolver = NULL;
+ }
+
~Lookup()
{
if (resolver)
@@ -204,8 +211,11 @@ public:
usr = Find(u);
if (usr)
{
- log(DEBUG,"Applying hostname lookup to %s: %s",usr->nick,hostname.c_str());
- if (hostname != "")
+ if (usr->registered == 7)
+ {
+ return true;
+ }
+ if ((hostname != "") && (usr->registered != 7))
{
strlcpy(usr->host,hostname.c_str(),MAXBUF);
WriteServ(usr->fd,"NOTICE Auth :Resolved your hostname: %s",hostname.c_str());
@@ -235,9 +245,7 @@ public:
}
};
-typedef std::deque<Lookup> dns_queue;
-
-dns_queue dnsq;
+Lookup dnsq[MAXBUF];
bool lookup_dns(std::string nick)
{
@@ -248,8 +256,14 @@ bool lookup_dns(std::string nick)
log(DEBUG,"Queueing DNS lookup for %s",u->nick);
WriteServ(u->fd,"NOTICE Auth :Looking up your hostname...");
Lookup L(nick);
- dnsq.push_back(L);
- return true;
+ for (int j = 0; j < MAXBUF; j++)
+ {
+ if (!dnsq[j].GetFD())
+ {
+ dnsq[j] = L;
+ return true;
+ }
+ }
}
return false;
}
@@ -257,16 +271,15 @@ bool lookup_dns(std::string nick)
void dns_poll()
{
// do we have items in the queue?
- if (dnsq.size())
+ for (int j = 0; j < MAXBUF; j++)
{
// are any ready, or stale?
- if (dnsq[0].Done() || (!dnsq[0].GetFD()))
+ if (dnsq[j].GetFD())
{
- if (dnsq[0].GetFD())
+ if (dnsq[j].Done())
{
- log(DEBUG,"****** DNS lookup for fd %d is complete. ******",dnsq[0].GetFD());
+ dnsq[j].Reset();
}
- dnsq.pop_front();
}
}
}