summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-09-14 19:31:22 -0400
committerAdam <Adam@anope.org>2010-09-14 19:31:22 -0400
commit6239b5a053fc8fd94b798495f8e189a2e2bda285 (patch)
treedcebc7977510969cbbcafafd98010c531256f0d2
parente7ac33fd622ae6e21bc9af684832b7de5cfa0c0c (diff)
Give DNS requests an error when their creator is being unloaded instead of just deleting them, and fixed a compile warning
-rw-r--r--include/dns.h1
-rw-r--r--src/dns.cpp3
2 files changed, 3 insertions, 1 deletions
diff --git a/include/dns.h b/include/dns.h
index 97cb0a677..51960b0f4 100644
--- a/include/dns.h
+++ b/include/dns.h
@@ -34,6 +34,7 @@ enum QueryFlags
enum DNSError
{
DNS_ERROR_UNKNOWN,
+ DNS_ERROR_UNLOADED,
DNS_ERROR_TIMEOUT,
DNS_ERROR_NOT_AN_ANSWER,
DNS_ERROR_NONSTANDARD_QUERY,
diff --git a/src/dns.cpp b/src/dns.cpp
index 7b96cf660..ebed29b5e 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, Module *c) : address(addr), QT(qt), creator(c)
+DNSRequest::DNSRequest(const Anope::string &addr, QueryType qt, bool cache, Module *c) : creator(c), address(addr), QT(qt)
{
if (!DNSEngine)
DNSEngine = new DNSManager();
@@ -541,6 +541,7 @@ void DNSManager::Cleanup(Module *mod)
if (req->creator && req->creator == mod)
{
+ req->OnError(DNS_ERROR_UNLOADED, "Module is being unloaded");
delete req;
this->requests.erase(id);
}