]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Reserve space for the content of the rings in exceed* 6351/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 19 Mar 2018 13:57:31 +0000 (14:57 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 19 Mar 2018 13:57:31 +0000 (14:57 +0100)
pdns/dnsdist-lua2.cc

index bd7d64b1ca4d063d173e5f6f70ccaf70b833572a..6f90a79b99f3089bb935cfd0fd19179bf009cab9 100644 (file)
@@ -145,6 +145,7 @@ static counts_t exceedRespGen(unsigned int rate, int seconds, std::function<void
 
   {
     std::lock_guard<std::mutex> lock(g_rings.respMutex);
+    counts.reserve(g_rings.respRing.size());
     for(const auto& c : g_rings.respRing) {
       if(seconds && c.when < cutoff)
         continue;
@@ -171,6 +172,7 @@ static counts_t exceedQueryGen(unsigned int rate, int seconds, std::function<voi
 
   {
     ReadLock rl(&g_rings.queryLock);
+    counts.reserve(g_rings.queryRing.size());
     for(const auto& c : g_rings.queryRing) {
       if(seconds && c.when < cutoff)
         continue;