infos.isHandler = true;
infos.thread = std::thread(recursorThread, 0, "web+stat");
- s_threadInfos.at(0).thread.join();
+ for (auto & ti : s_threadInfos) {
+ ti.thread.join();
+ }
}
return 0;
}
time_t carbonInterval=::arg().asNum("carbon-interval");
time_t luaMaintenanceInterval=::arg().asNum("lua-maintenance-interval");
counter.store(0); // used to periodically execute certain tasks
- for(;;) {
+
+ while (!RecursorControlChannel::stop) {
while(MT->schedule(&g_now)); // MTasker letting the mthreads do their thing
if(!(counter%500)) {
}
}
}
+ return 0;
}
catch(PDNSException &ae) {
g_log<<Logger::Error<<"Exception: "<<ae.reason<<endl;
#include "namespaces.hh"
+volatile sig_atomic_t RecursorControlChannel::stop;
+
RecursorControlChannel::RecursorControlChannel()
{
d_fd=-1;
std::string recv(std::string* remote=0, unsigned int timeout=5);
int d_fd;
+ static volatile sig_atomic_t stop;
private:
struct sockaddr_un d_local;
};
{
g_log<<Logger::Error<<"Exiting on user request"<<endl;
extern RecursorControlChannel s_rcc;
- s_rcc.~RecursorControlChannel();
+ s_rcc.~RecursorControlChannel();
extern string s_pidfname;
- if(!s_pidfname.empty())
+ if(!s_pidfname.empty())
unlink(s_pidfname.c_str()); // we can at least try..
- if(nicely)
- exit(1);
- else
+ if(nicely) {
+ RecursorControlChannel::stop = 1;
+ } else {
_exit(1);
+ }
}
void doExit()