From 6ec0186caa49da8ab767695c4a48246c14bc02bb Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Sun, 12 Jun 2016 10:06:01 +0100 Subject: [PATCH] Implement DINIT_CP_RELEASESERVICE command. --- src/control.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/control.cc b/src/control.cc index 937269c..acd2aa3 100644 --- a/src/control.cc +++ b/src/control.cc @@ -161,24 +161,32 @@ void ControlConn::processStartStop(int pktType) bool already_there = false; switch (pktType) { case DINIT_CP_STARTSERVICE: + // start service, mark as required if (do_pin) service->pinStart(); service->start(); already_there = service->getState() == ServiceState::STARTED; break; case DINIT_CP_STOPSERVICE: + // force service to stop if (do_pin) service->pinStop(); - service->stop(); + service->stop(true); + service->forceStop(); already_there = service->getState() == ServiceState::STOPPED; break; case DINIT_CP_WAKESERVICE: - // re-start a stopped service. + // re-start a stopped service (do not mark as required) if (do_pin) service->pinStart(); service->start(false); already_there = service->getState() == ServiceState::STARTED; break; - default: /* DINIT_CP_RELEASESERVICE */ - // remove explicit start from a service, without necessarily stopping it. - // TODO. + case DINIT_CP_RELEASESERVICE: + // remove required mark, stop if not required by dependents + if (do_pin) service->pinStop(); + service->stop(); + already_there = service->getState() == ServiceState::STOPPED; + break; + default: + // TODO return an error break; } -- 2.25.1