]> granicus.if.org Git - pdns/commitdiff
rec: Wait until after daemonizing to start the outgoing protobuf thread
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 16 Dec 2016 09:40:55 +0000 (10:40 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 13 Jan 2017 13:43:52 +0000 (14:43 +0100)
(cherry picked from commit a79b00a6df3076c1f7af87d0fd093e8aa2fc4e9f)

pdns/rec-lua-conf.cc

index 1b91ad85a8388fd4ca763a1d57b074ff6e0342e2..2347b18c217ef6f68e935dcc136935bcb1d0e69c 100644 (file)
@@ -288,11 +288,13 @@ void loadRecursorLuaConfig(const std::string& fname, bool checkOnly)
       }
     });
 
-  Lua.writeFunction("outgoingProtobufServer", [&lci](const string& server_, const boost::optional<uint16_t> timeout, const boost::optional<uint64_t> maxQueuedEntries, const boost::optional<uint8_t> reconnectWaitTime, boost::optional<bool> asyncConnect) {
+  Lua.writeFunction("outgoingProtobufServer", [&lci, checkOnly](const string& server_, const boost::optional<uint16_t> timeout, const boost::optional<uint64_t> maxQueuedEntries, const boost::optional<uint8_t> reconnectWaitTime, boost::optional<bool> asyncConnect) {
       try {
        ComboAddress server(server_);
         if (!lci.outgoingProtobufServer) {
-          lci.outgoingProtobufServer = std::make_shared<RemoteLogger>(server, timeout ? *timeout : 2, maxQueuedEntries ? *maxQueuedEntries : 100, reconnectWaitTime ? *reconnectWaitTime : 1, asyncConnect ? *asyncConnect : false);
+          if (!checkOnly) {
+            lci.outgoingProtobufServer = std::make_shared<RemoteLogger>(server, timeout ? *timeout : 2, maxQueuedEntries ? *maxQueuedEntries : 100, reconnectWaitTime ? *reconnectWaitTime : 1, asyncConnect ? *asyncConnect : false);
+          }
         }
         else {
           theL()<<Logger::Error<<"Only one protobuf server can be configured, we already have "<<lci.protobufServer->toString()<<endl;