From: Pieter Lexis Date: Tue, 28 May 2019 12:17:44 +0000 (+0200) Subject: Make the TCPNameserver a unique pointer X-Git-Tag: dnsdist-1.4.0-beta1~10^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8c98b3411da53a81e3c07ce5754eb9896bfaf29c;p=pdns Make the TCPNameserver a unique pointer --- 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<