aboutsummaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorGravatar brain2007-01-07 21:16:03 +0000
committerGravatar brain2007-01-07 21:16:03 +0000
commitdac672cf303ce44dc5f877a5f9f7e5aee64b95e1 (patch)
tree3484e7870d732dd04a590640cfe5c72ea50e7dde /src/users.cpp
parentMove all /WHOWAS related out of core and into cmd_whowas. (diff)
DNS Stuff - this wont work right yet, it will soon (tm)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6250 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 0e25f8e55..37664a629 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -151,8 +151,12 @@ void userrec::StartDNSLookup()
try
{
ServerInstance->Log(DEBUG,"Passing instance: %08x",this->ServerInstance);
- res_reverse = new UserResolver(this->ServerInstance, this, this->GetIPString(), DNS_QUERY_REVERSE);
- this->ServerInstance->AddResolver(res_reverse);
+ bool cached;
+ res_reverse = new UserResolver(this->ServerInstance, this, this->GetIPString(), DNS_QUERY_REVERSE, cached);
+ if (!cached)
+ this->ServerInstance->AddResolver(res_reverse);
+ else
+ delete res_reverse;
}
catch (CoreException& e)
{
@@ -160,8 +164,8 @@ void userrec::StartDNSLookup()
}
}
-UserResolver::UserResolver(InspIRCd* Instance, userrec* user, std::string to_resolve, QueryType qt) :
- Resolver(Instance, to_resolve, qt), bound_user(user)
+UserResolver::UserResolver(InspIRCd* Instance, userrec* user, std::string to_resolve, QueryType qt, bool &cache) :
+ Resolver(Instance, to_resolve, qt, cache), bound_user(user)
{
this->fwd = (qt == DNS_QUERY_A || qt == DNS_QUERY_AAAA);
this->bound_fd = user->GetFd();
@@ -178,13 +182,17 @@ void UserResolver::OnLookupComplete(const std::string &result, unsigned int ttl)
/* Check we didnt time out */
if (this->bound_user->registered != REG_ALL)
{
+ bool cached;
#ifdef IPV6
const char *ip = this->bound_user->GetIPString();
- bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, (strstr(ip,"0::ffff:") == ip ? DNS_QUERY_A : DNS_QUERY_AAAA));
+ bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, (strstr(ip,"0::ffff:") == ip ? DNS_QUERY_A : DNS_QUERY_AAAA), cached);
#else
- bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, DNS_QUERY_A);
+ bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, DNS_QUERY_A, cached);
#endif
- this->ServerInstance->AddResolver(bound_user->res_forward);
+ if (!cached)
+ this->ServerInstance->AddResolver(bound_user->res_forward);
+ else
+ delete bound_user->res_forward;
}
}
catch (CoreException& e)