From c29dbdffcb6f67812f823f1f844b87320cf6b437 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 20 Aug 2015 10:40:45 +0200 Subject: Add basic (non weight adjusted) shuffling for SrvRecords selection Also add "Debug::Acquire::SrvRecs" debug option and the option "Acquire::EnableSrvRecods" to allow disabling this lookup. --- methods/connect.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'methods') diff --git a/methods/connect.cc b/methods/connect.cc index 9e0f01ee3..5612af6ec 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -272,7 +272,8 @@ bool Connect(std::string Host,int Port,const char *Service, if(LastHost != Host || LastPort != Port) { SrvRecords.clear(); - bool res = GetSrvRecords(Host, DefPort, SrvRecords); + if (_config->FindB("Acquire::EnableSrvRecods", true) == true) + GetSrvRecords(Host, DefPort, SrvRecords); } // we have no SrvRecords for this host, connect right away if(SrvRecords.size() == 0) @@ -282,7 +283,7 @@ bool Connect(std::string Host,int Port,const char *Service, // try to connect in the priority order of the srv records while(SrvRecords.size() > 0) { - Host = SrvRecords[0].target; + Host = PopFromSrvRecs(SrvRecords).target; if(ConnectToHostname(Host, Port, Service, DefPort, Fd, TimeOut, Owner)) return true; -- cgit v1.2.3