summaryrefslogtreecommitdiff
path: root/src/win32/signalServiceHandler.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/win32/signalServiceHandler.hpp')
-rw-r--r--src/win32/signalServiceHandler.hpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/win32/signalServiceHandler.hpp b/src/win32/signalServiceHandler.hpp
index 28121f4..da16de5 100644
--- a/src/win32/signalServiceHandler.hpp
+++ b/src/win32/signalServiceHandler.hpp
@@ -30,22 +30,19 @@
* along with anytun. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef ANYTUN_signalServiceHandler_h_INCLUDED
-#define ANYTUN_signalServiceHandler_h_INCLUDED
+#ifndef ANYTUN_signalServiceHandler_hpp_INCLUDED
+#define ANYTUN_signalServiceHandler_hpp_INCLUDED
#include "winService.h"
-void registerSignalHandler(SignalController& ctrl, WinService* service)
+void registerSignalHandler(SignalController& ctrl, WinService& service)
{
- if(!service)
- return;
+ 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.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)));
+ 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)));
}
#endif