summaryrefslogtreecommitdiff
path: root/src/dns.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dns.cpp')
-rw-r--r--src/dns.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index 329c03c86..7b96cf660 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -7,7 +7,7 @@ static inline unsigned short GetRandomID()
return random();
}
-DNSRequest::DNSRequest(const Anope::string &addr, QueryType qt, bool cache) : address(addr), QT(qt)
+DNSRequest::DNSRequest(const Anope::string &addr, QueryType qt, bool cache, Module *c) : address(addr), QT(qt), creator(c)
{
if (!DNSEngine)
DNSEngine = new DNSManager();
@@ -531,6 +531,22 @@ void DNSManager::Tick(time_t now)
}
}
+void DNSManager::Cleanup(Module *mod)
+{
+ for (std::map<short, DNSRequest *>::iterator it = this->requests.begin(), it_end = this->requests.end(); it != it_end;)
+ {
+ short id = it->first;
+ DNSRequest *req = it->second;
+ ++it;
+
+ if (req->creator && req->creator == mod)
+ {
+ delete req;
+ this->requests.erase(id);
+ }
+ }
+}
+
DNSRequestTimeout::DNSRequestTimeout(DNSRequest *r, time_t timeout) : Timer(timeout), request(r)
{
this->done = false;