]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Stuff to allow resolving of AAAA record, and on failure try A record
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 6 Feb 2007 18:49:30 +0000 (18:49 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Tue, 6 Feb 2007 18:49:30 +0000 (18:49 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6521 e03df62e-2008-0410-955e-edbf42e46eb7

src/modules/m_spanningtree/resolvers.cpp
src/modules/m_spanningtree/resolvers.h

index 01e994d579be5151a3494328f6a3282743a24044..8165244af4cac19fde369c76f20799398e4fe497 100644 (file)
@@ -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);
 }
index 3828985d4f4931bc4e1bcb2283177e3f16647cd6..10cc6f3ca7bc0b819050f64d4e1eef16a5269778 100644 (file)
@@ -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);
 };