diff options
author | Adam <Adam@anope.org> | 2010-09-16 22:21:55 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-09-16 22:21:55 -0400 |
commit | 61e75646339753609d25aad0f4f8f60db1c966b5 (patch) | |
tree | 43cca7040156e014a57a8cb096c13137395e3250 /src/dns.cpp | |
parent | 86c1dab2863f228e92ce7e0bd23ffb17cda0242b (diff) |
Fixed connecting back to the nameserver if we lose connection, and detecting the nameserver
Diffstat (limited to 'src/dns.cpp')
-rw-r--r-- | src/dns.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/dns.cpp b/src/dns.cpp index ebed29b5e..c613dc776 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -1,6 +1,6 @@ #include "services.h" -DNSManager *DNSEngine; +DNSManager *DNSEngine = NULL; static inline unsigned short GetRandomID() { @@ -11,6 +11,8 @@ DNSRequest::DNSRequest(const Anope::string &addr, QueryType qt, bool cache, Modu { if (!DNSEngine) DNSEngine = new DNSManager(); + if (!DNSEngine->sock) + DNSEngine->sock = new DNSSocket(Config->NameServer, DNSManager::DNSPort); if (DNSEngine->packets.size() == 65535) throw SocketException("DNS queue full"); @@ -474,15 +476,6 @@ bool DNSSocket::ProcessWrite() DNSManager::DNSManager() : Timer(3600, Anope::CurTime, true) { this->sock = NULL; - - try - { - this->sock = new DNSSocket(Config->NameServer, DNSManager::DNSPort); - } - catch (const SocketException &ex) - { - throw SocketException("Unable to connect to nameserver: " + ex.GetReason()); - } } DNSManager::~DNSManager() |