]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Keep the local copy of the downstream servers around
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 18 Nov 2022 15:56:47 +0000 (16:56 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 6 Dec 2022 11:11:59 +0000 (12:11 +0100)
pdns/dnsdist.cc

index d0b3fbec937d059a47ce3bf8352722d828690350..5ba75b4bb72e00b1b64e0baf5cc83fff7085ec3e 100644 (file)
@@ -1942,13 +1942,12 @@ static void healthChecksThread()
   setThreadName("dnsdist/healthC");
 
   constexpr int interval = 1;
+  auto states = g_dstates.getLocal(); // this points to the actual shared_ptrs!
 
   for (;;) {
     sleep(interval);
 
     std::unique_ptr<FDMultiplexer> mplexer{nullptr};
-
-    auto states = g_dstates.getLocal(); // this points to the actual shared_ptrs!
     for (auto& dss : *states) {
       auto delta = dss->sw.udiffAndSet()/1000000.0;
       dss->queryLoad.store(1.0*(dss->queries.load() - dss->prev.queries.load())/delta);