]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
in dnsdist maintenance thread we'd lock up trying to lock g_luamutex twice
authorbert hubert <bert.hubert@netherlabs.nl>
Fri, 26 Feb 2016 17:12:21 +0000 (18:12 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 26 Feb 2016 17:12:21 +0000 (18:12 +0100)
pdns/dnsdist.cc

index a793a15d92a07cfc01bd2ba1135a6717359b6102..b0447bb9cd44e028857c3e4fdc5f09ab4d6e2d7c 100644 (file)
@@ -1012,10 +1012,12 @@ void* maintThread()
   for(;;) {
     sleep(interval);
 
-    std::lock_guard<std::mutex> lock(g_luamutex);
-    auto f =g_lua.readVariable<boost::optional<std::function<void()> > >("maintenance");
-    if(f)
-      (*f)();
+    {
+      std::lock_guard<std::mutex> lock(g_luamutex);
+      auto f =g_lua.readVariable<boost::optional<std::function<void()> > >("maintenance");
+      if(f)
+        (*f)();
+    }
 
     counter++;
     if (counter >= g_cacheCleaningDelay) {