CommunicatorClass Communicator;
shared_ptr<UDPNameserver> N;
int avg_latency;
-TCPNameserver *TN;
+unique_ptr<TCPNameserver> TN;
static vector<DNSDistributor*> g_distributors;
vector<std::shared_ptr<UDPNameserver> > g_udpReceivers;
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);
extern std::shared_ptr<UDPNameserver> N;
extern vector<std::shared_ptr<UDPNameserver> > g_udpReceivers;
extern int avg_latency;
-extern TCPNameserver *TN;
+extern std::unique_ptr<TCPNameserver> TN;
extern ArgvMap & arg( void );
extern void declareArguments();
extern void declareStats();
}
}
- TN = new TCPNameserver;
+ TN = make_unique<TCPNameserver>();
}
catch(const ArgException &A) {
g_log<<Logger::Error<<"Fatal error: "<<A.reason<<endl;