diff --git a/tdns/tres.cc b/tdns/tres.cc index ee4e9a2..1f65074 100644 --- a/tdns/tres.cc +++ b/tdns/tres.cc @@ -3,8 +3,8 @@ #include #include #include "sclasses.hh" -#include #include +#include #include "record-types.hh" /*! @@ -141,16 +141,25 @@ struct NodataException{}; root-servers. */ -vector> resolveAt(const DNSName& dn, const DNSType& dt, int depth=0, const DNSName& auth={}, const multimap& servers=g_root) +vector> resolveAt(const DNSName& dn, const DNSType& dt, int depth=0, const DNSName& auth={}, const multimap& mservers=g_root) { std::string prefix(depth, ' '); prefix += dn.toString() + "|"+toString(dt)+" "; vector> ret; // it is good form to sort the servers in order of response time - // for tres, this is not done, but it would be good to randomize this a bit + // for tres, this is not done, but we do randomize + + cout << prefix << "Starting query at authority = "< > servers; + for(auto& sp : mservers) + servers.push_back(sp); + + std::random_device rd; + std::mt19937 g(rd()); + std::shuffle(servers.begin(), servers.end(), g); - cout << prefix << "Starting query at authority = "<