summaryrefslogtreecommitdiff
path: root/src/dns.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-10 20:13:59 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-10 20:13:59 +0000
commit25493049050dadfa08527c813f4209a09beab6a7 (patch)
tree65f803c34106dccef63cadbbd8a0f60fdc9fd4f5 /src/dns.cpp
parentff7b9e9af0a502989fa88b096b2183590193e2cc (diff)
Add fix for patch #166 (this is a reasonably big one)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5679 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/dns.cpp')
-rw-r--r--src/dns.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index 3381c18fa..23e1dfcab 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -870,7 +870,7 @@ DNS::~DNS()
}
/** High level abstraction of dns used by application at large */
-Resolver::Resolver(InspIRCd* Instance, const std::string &source, QueryType qt) : ServerInstance(Instance), input(source), querytype(qt)
+Resolver::Resolver(InspIRCd* Instance, const std::string &source, QueryType qt, Module* creator) : ServerInstance(Instance), Creator(creator), input(source), querytype(qt)
{
ServerInstance->Log(DEBUG,"Instance: %08x %08x",Instance, ServerInstance);
@@ -948,6 +948,11 @@ int Resolver::GetId()
return this->myid;
}
+Module* Resolver::GetCreator()
+{
+ return this->Creator;
+}
+
/** Process a socket read event */
void DNS::HandleEvent(EventType et, int errornum)
{
@@ -1025,6 +1030,22 @@ bool DNS::AddResolverClass(Resolver* r)
}
}
+void DNS::CleanResolvers(Module* module)
+{
+ for (int i = 0; i < MAX_REQUEST_ID; i++)
+ {
+ if (Classes[i])
+ {
+ if (Classes[i]->GetCreator() == module)
+ {
+ Classes[i]->OnError(RESLOVER_FORCEUNLOAD, "Parent module is unloading");
+ delete Classes[i];
+ Classes[i] = NULL;
+ }
+ }
+ }
+}
+
/** Generate pseudo-random number */
unsigned long DNS::PRNG()
{