change signal SIGHUP action from abort process to ignore
log signal value when process aborted by signal
This commit is contained in:
fortrue 2018-03-16 12:28:07 +08:00
parent 37b3a07b9f
commit ec36627f91
2 changed files with 6 additions and 6 deletions

View File

@ -12,10 +12,10 @@
#if _PREDIXY_BACKTRACE_
#include <execinfo.h>
inline void traceInfo()
inline void traceInfo(int sig)
{
#define Size 128
logError("predixy backtrace");
logError("predixy backtrace(%d)", sig);
void* buf[Size];
int num = ::backtrace(buf, Size);
int fd = -1;
@ -32,9 +32,9 @@ inline void traceInfo()
#else
inline void traceInfo()
inline void traceInfo(int sig)
{
logError("predixy backtrace, but current system unspport backtrace");
logError("predixy backtrace(%d), but current system unspport backtrace", sig);
}
#endif

View File

@ -27,7 +27,7 @@ static bool Stop = false;
static void abortHandler(int sig)
{
if (!Abort) {
traceInfo();
traceInfo(sig);
}
Abort = true;
if (!Running) {
@ -65,6 +65,7 @@ Proxy::~Proxy()
bool Proxy::init(int argc, char* argv[])
{
signal(SIGHUP, SIG_IGN);
signal(SIGPIPE, SIG_IGN);
signal(SIGFPE, abortHandler);
signal(SIGILL, abortHandler);
@ -72,7 +73,6 @@ bool Proxy::init(int argc, char* argv[])
signal(SIGABRT, abortHandler);
signal(SIGBUS, abortHandler);
signal(SIGQUIT, abortHandler);
signal(SIGHUP, abortHandler);
signal(SIGINT, stopHandler);
signal(SIGTERM, stopHandler);