]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Avoid copying of pthread_rwlock_t 8601/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 2 Dec 2019 15:06:33 +0000 (16:06 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 2 Dec 2019 16:09:15 +0000 (17:09 +0100)
pdns/auth-packetcache.cc
pdns/auth-packetcache.hh
pdns/auth-querycache.cc
pdns/auth-querycache.hh

index 8389c17963ef7185c8895d30e9a77998952f3d26..c38599deced21db8663d324f68483b6415b3f193 100644 (file)
@@ -30,10 +30,8 @@ extern StatBag S;
 
 const unsigned int AuthPacketCache::s_mincleaninterval, AuthPacketCache::s_maxcleaninterval;
 
-AuthPacketCache::AuthPacketCache(size_t mapsCount): d_lastclean(time(nullptr))
+AuthPacketCache::AuthPacketCache(size_t mapsCount): d_lastclean(time(nullptr)), d_maps(mapsCount)
 {
-  d_maps.resize(mapsCount);
-
   S.declare("packetcache-hit", "Number of hits on the packet cache");
   S.declare("packetcache-miss", "Number of misses on the packet cache");
   S.declare("packetcache-size", "Number of entries in the packet cache");
index ba49128bf93252501c8150bb9af0f2839145d260..e0191dc95008bede5c077d6d5a70a6110a4a8563 100644 (file)
@@ -110,6 +110,9 @@ private:
     ~MapCombo() {
       pthread_rwlock_destroy(&d_mut);
     }
+    MapCombo(const MapCombo&) = delete; 
+    MapCombo& operator=(const MapCombo&) = delete;
+
     pthread_rwlock_t d_mut;
     cmap_t d_map;
   };
index 0bc546e9bff793fb9b5ecb4e466ef0c5ecd154d9..2dc8c3254b1c950feabfdedce286aa5dcfe90857 100644 (file)
@@ -31,10 +31,8 @@ extern StatBag S;
 
 const unsigned int AuthQueryCache::s_mincleaninterval, AuthQueryCache::s_maxcleaninterval;
 
-AuthQueryCache::AuthQueryCache(size_t mapsCount): d_lastclean(time(nullptr))
+AuthQueryCache::AuthQueryCache(size_t mapsCount): d_maps(mapsCount), d_lastclean(time(nullptr))
 {
-  d_maps.resize(mapsCount);
-
   S.declare("query-cache-hit","Number of hits on the query cache");
   S.declare("query-cache-miss","Number of misses on the query cache");
   S.declare("query-cache-size", "Number of entries in the query cache");
index e48ad2dfb05015cb0ee170ec6f8ad950d7019e10..193f91bf92b8d37080d755d1557be46c5c6c41c0 100644 (file)
@@ -93,6 +93,9 @@ private:
     ~MapCombo() {
       pthread_rwlock_destroy(&d_mut);
     }
+    MapCombo(const MapCombo &) = delete; 
+    MapCombo & operator=(const MapCombo &) = delete;
+
     pthread_rwlock_t d_mut;
     cmap_t d_map;
   };