From 8c98b3411da53a81e3c07ce5754eb9896bfaf29c Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Tue, 28 May 2019 14:17:44 +0200 Subject: [PATCH] Make the TCPNameserver a unique pointer --- pdns/common_startup.cc | 5 ++--- pdns/common_startup.hh | 2 +- pdns/receiver.cc | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index b4334b9f2..e593cba2f 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -52,7 +52,7 @@ DynListener *dl; CommunicatorClass Communicator; shared_ptr N; int avg_latency; -TCPNameserver *TN; +unique_ptr TN; static vector g_distributors; vector > g_udpReceivers; @@ -606,8 +606,7 @@ void mainthread() if(::arg().mustDo("slave") || ::arg().mustDo("master") || !::arg()["forward-notify"].empty()) Communicator.go(); - if(TN) - TN->go(); // tcp nameserver launch + TN->go(); // tcp nameserver launch // fork(); (this worked :-)) unsigned int max_rthreads= ::arg().asNum("receiver-threads", 1); diff --git a/pdns/common_startup.hh b/pdns/common_startup.hh index 1e1290ed5..f19a1f161 100644 --- a/pdns/common_startup.hh +++ b/pdns/common_startup.hh @@ -46,7 +46,7 @@ extern CommunicatorClass Communicator; extern std::shared_ptr N; extern vector > g_udpReceivers; extern int avg_latency; -extern TCPNameserver *TN; +extern std::unique_ptr TN; extern ArgvMap & arg( void ); extern void declareArguments(); extern void declareStats(); diff --git a/pdns/receiver.cc b/pdns/receiver.cc index dfe609c35..9d8818315 100644 --- a/pdns/receiver.cc +++ b/pdns/receiver.cc @@ -590,7 +590,7 @@ int main(int argc, char **argv) } } - TN = new TCPNameserver; + TN = make_unique(); } catch(const ArgException &A) { g_log<