From: brain Date: Tue, 6 Feb 2007 18:49:30 +0000 (+0000) Subject: Stuff to allow resolving of AAAA record, and on failure try A record X-Git-Tag: v2.0.23~5868 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=c328ffca4cdb0300e6eee88f91e718ce9ba850ce;p=user%2Fhenk%2Fcode%2Finspircd.git Stuff to allow resolving of AAAA record, and on failure try A record git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6521 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/src/modules/m_spanningtree/resolvers.cpp b/src/modules/m_spanningtree/resolvers.cpp index 01e994d57..8165244af 100644 --- a/src/modules/m_spanningtree/resolvers.cpp +++ b/src/modules/m_spanningtree/resolvers.cpp @@ -25,7 +25,7 @@ * callback to OnLookupComplete or OnError when completed. Once it has completed we * will have an IP address which we can then use to continue our connection. */ -ServernameResolver::ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, cached, me), MyLink(x), Utils(Util) +ServernameResolver::ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached, QueryType qt) : Resolver(Instance, hostname, qt, cached, me), MyLink(x), Utils(Util), query(qt), host(hostname), mine(me) { /* Nothing in here, folks */ } @@ -62,6 +62,13 @@ void ServernameResolver::OnLookupComplete(const std::string &result, unsigned in void ServernameResolver::OnError(ResolverError e, const std::string &errormessage) { /* Ooops! */ + if (query == QUERY_TYPE_AAAA) + { + bool cached; + ServernameResolver* snr = new ServernameResolver(mine, Utils, ServerInstance, host, MyLink, cached, DNS_QUERY_A); + ServerInstance->AddResolver(snr, cached); + return; + } ServerInstance->SNO->WriteToSnoMask('l',"CONNECT: Error connecting \002%s\002: Unable to resolve hostname - %s",MyLink.Name.c_str(),errormessage.c_str()); Utils->DoFailOver(&MyLink); } diff --git a/src/modules/m_spanningtree/resolvers.h b/src/modules/m_spanningtree/resolvers.h index 3828985d4..10cc6f3ca 100644 --- a/src/modules/m_spanningtree/resolvers.h +++ b/src/modules/m_spanningtree/resolvers.h @@ -44,6 +44,7 @@ class SecurityIPResolver : public Resolver bool cached; SecurityIPResolver* res = new SecurityIPResolver(mine, Utils, ServerInstance, host, MyLink, cached, DNS_QUERY_A); ServerInstance->AddResolver(res, cached); + return; } ServerInstance->Log(DEFAULT,"Could not resolve IP associated with Link '%s': %s",MyLink.Name.c_str(),errormessage.c_str()); } @@ -64,8 +65,11 @@ class ServernameResolver : public Resolver */ Link MyLink; SpanningTreeUtilities* Utils; + QueryType query; + std::string host; + Module* mine; public: - ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached); + ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached, QueryType qt); void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached); void OnError(ResolverError e, const std::string &errormessage); };