]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Prevent copies when updating the State Holder
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 18 Nov 2019 09:13:08 +0000 (10:13 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 18 Nov 2019 09:13:08 +0000 (10:13 +0100)
pdns/pdns_recursor.cc
pdns/rec-lua-conf.cc
pdns/rec_channel_rec.cc

index 116e0d67235d804d4025fdc00dffaa96cfcd438d..5f4d8faa7537620f722d0e92c648c94767458534 100644 (file)
@@ -4047,14 +4047,14 @@ static int serviceMain(int argc, char*argv[])
     for (const auto &p : parts) {
       dontThrottleNames.add(DNSName(p));
     }
-    g_dontThrottleNames.setState(dontThrottleNames);
+    g_dontThrottleNames.setState(std::move(dontThrottleNames));
 
     NetmaskGroup dontThrottleNetmasks;
     stringtok(parts, ::arg()["dont-throttle-netmasks"]);
     for (const auto &p : parts) {
       dontThrottleNetmasks.addMask(Netmask(p));
     }
-    g_dontThrottleNetmasks.setState(dontThrottleNetmasks);
+    g_dontThrottleNetmasks.setState(std::move(dontThrottleNetmasks));
   }
 
   s_balancingFactor = ::arg().asDouble("distribution-load-factor");
index db9c02f7502edcc304c899be6cb32e4d6d934539..339ea604f542de999945d9eea0a74a268428aa7f 100644 (file)
@@ -570,7 +570,7 @@ void loadRecursorLuaConfig(const std::string& fname, luaConfigDelayedThreads& de
 
   try {
     Lua.executeCode(ifs);
-    g_luaconfs.setState(lci);
+    g_luaconfs.setState(std::move(lci));
   }
   catch(const LuaContext::ExecutionErrorException& e) {
     g_log<<Logger::Error<<"Unable to load Lua script from '"+fname+"': ";
index a294e62ac7a7d8dd820e0c4bd0596552f64b5eb6..811d1bcd66b0bbebceff0311f901028de3e7de85 100644 (file)
@@ -1438,7 +1438,7 @@ static string addDontThrottleNames(T begin, T end) {
     dnt.add(d);
   }
 
-  g_dontThrottleNames.setState(dnt);
+  g_dontThrottleNames.setState(std::move(dnt));
 
   ret += " to the list of nameservers that may not be throttled";
   g_log<<Logger::Info<<ret<<", requested via control channel"<<endl;
@@ -1477,7 +1477,7 @@ static string addDontThrottleNetmasks(T begin, T end) {
     dnt.addMask(t);
   }
 
-  g_dontThrottleNetmasks.setState(dnt);
+  g_dontThrottleNetmasks.setState(std::move(dnt));
 
   ret += " to the list of nameserver netmasks that may not be throttled";
   g_log<<Logger::Info<<ret<<", requested via control channel"<<endl;
@@ -1491,7 +1491,7 @@ static string clearDontThrottleNames(T begin, T end) {
 
   if (begin + 1 == end && *begin == "*"){
     SuffixMatchNode smn;
-    g_dontThrottleNames.setState(smn);
+    g_dontThrottleNames.setState(std::move(smn));
     string ret = "Cleared list of nameserver names that may not be throttled";
     g_log<<Logger::Warning<<ret<<", requested via control channel"<<endl;
     return ret + "\n";
@@ -1523,7 +1523,7 @@ static string clearDontThrottleNames(T begin, T end) {
     dnt.remove(name);
   }
 
-  g_dontThrottleNames.setState(dnt);
+  g_dontThrottleNames.setState(std::move(dnt));
 
   ret += " from the list of nameservers that may not be throttled";
   g_log<<Logger::Info<<ret<<", requested via control channel"<<endl;
@@ -1538,7 +1538,7 @@ static string clearDontThrottleNetmasks(T begin, T end) {
   if (begin + 1 == end && *begin == "*"){
     auto nmg = g_dontThrottleNetmasks.getCopy();
     nmg.clear();
-    g_dontThrottleNetmasks.setState(nmg);
+    g_dontThrottleNetmasks.setState(std::move(nmg));
 
     string ret = "Cleared list of nameserver addresses that may not be throttled";
     g_log<<Logger::Warning<<ret<<", requested via control channel"<<endl;
@@ -1575,7 +1575,7 @@ static string clearDontThrottleNetmasks(T begin, T end) {
     dnt.deleteMask(mask);
   }
 
-  g_dontThrottleNetmasks.setState(dnt);
+  g_dontThrottleNetmasks.setState(std::move(dnt));
 
   ret += " from the list of nameservers that may not be throttled";
   g_log<<Logger::Info<<ret<<", requested via control channel"<<endl;