]> granicus.if.org Git - pdns/commitdiff
dnsdist: Lock the response ring in exceedRespGen()
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 21 Jan 2016 10:19:55 +0000 (11:19 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 21 Jan 2016 10:19:55 +0000 (11:19 +0100)
Hopefully this should fix #3277.

pdns/dnsdist-lua2.cc

index 0172032cc214ec5108be6546d816a48b98e054fb..3c2c06f0dd0ab03fc575bc60234029be67ce09a6 100644 (file)
@@ -61,7 +61,8 @@ map<ComboAddress,int> exceedRespGen(int rate, int seconds, std::function<void(co
   clock_gettime(CLOCK_MONOTONIC, &now);
   cutoff = mintime = now;
   cutoff.tv_sec -= seconds;
-  
+
+  std::lock_guard<std::mutex> lock(g_rings.respMutex);
   for(const auto& c : g_rings.respRing) {
     if(seconds && c.when < cutoff)
       continue;