diff options
-rw-r--r-- | src/signalController.cpp | 9 | ||||
-rw-r--r-- | src/signalController.h | 1 | ||||
-rw-r--r-- | src/win32/signalServiceHandler.hpp | 1 |
3 files changed, 9 insertions, 2 deletions
diff --git a/src/signalController.cpp b/src/signalController.cpp index 244c32f..c690608 100644 --- a/src/signalController.cpp +++ b/src/signalController.cpp @@ -117,8 +117,13 @@ int SignalController::run() if(ret) break; } - else - cLog.msg(Log::PRIO_NOTICE) << "SIG " << sig.first << " caught with message '" << sig.second << "' - ignoring"; + else { + it = handler.find(SIGUNKNOWN); + if(it != handler.end()) + it->second(sig.first, sig.second); + else + cLog.msg(Log::PRIO_NOTICE) << "SIG " << sig.first << " caught with message '" << sig.second << "' - ignoring"; + } } for(CallbackMap::iterator it = callbacks.begin(); it != callbacks.end(); ++it) diff --git a/src/signalController.h b/src/signalController.h index c19f208..568a427 100644 --- a/src/signalController.h +++ b/src/signalController.h @@ -46,6 +46,7 @@ typedef int DaemonService; #endif #define SIGERROR -1 +#define SIGUNKNOWN -2 typedef int SigNum; typedef boost::function<int (SigNum const&, std::string const&)> SignalHandler; diff --git a/src/win32/signalServiceHandler.hpp b/src/win32/signalServiceHandler.hpp index 67d0774..28121f4 100644 --- a/src/win32/signalServiceHandler.hpp +++ b/src/win32/signalServiceHandler.hpp @@ -42,6 +42,7 @@ void registerSignalHandler(SignalController& ctrl, WinService* service) ctrl.handler[SERVICE_CONTROL_STOP] = boost::bind(&WinService::handleCtrlSignal, service, _1, _2); ctrl.handler[SERVICE_CONTROL_INTERROGATE] = boost::bind(&WinService::handleCtrlSignal, service, _1, _2); + ctrl.handler[SIGUNKNOWN] = boost::bind(&WinService::handleCtrlSignal, service, _1, _2); ctrl.callbacks.insert(SignalController::CallbackMap::value_type(CALLB_RUNNING, boost::bind(&WinService::reportStatus, service, SERVICE_RUNNING, NO_ERROR))); ctrl.callbacks.insert(SignalController::CallbackMap::value_type(CALLB_STOPPING, boost::bind(&WinService::reportStatus, service, SERVICE_STOP_PENDING, NO_ERROR))); |