#include <signal.h>
class HeadProcessor {
public:
HeadProcessor() {}
~HeadProcessor() {}
(void)data;
(void)datatype;
(void)datalen;
std::string result = "{";
for (auto &t : procs) {
result +="\"" + t.first + "\":\"" + t.second + "\",";
}
result += "}";
}
};
static void killSignal(const int sig) {
(void)sig;
if (gEventLoop != nullptr) {
delete gEventLoop;
}
exit(0);
}
static void reloadConf(const int sig) {
(void)sig;
}
static void registerSignal() {
signal(SIGPIPE, SIG_IGN);
signal(SIGINT, killSignal);
signal(SIGKILL, killSignal);
signal(SIGQUIT, killSignal);
signal(SIGTERM, killSignal);
signal(SIGHUP, killSignal);
signal(SIGSEGV, killSignal);
signal(SIGUSR1, reloadConf);
}
int main(void) {
registerSignal();
HeadProcessor headProcessor;
headInterface.
setReadHandler(std::bind(&HeadProcessor::readHandler, &headProcessor, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3,
std::placeholders::_4, std::placeholders::_5));
std::placeholders::_1));
std::placeholders::_2, std::placeholders::_3));
headServer.start(1);
return 0;
}