From 16781b1333fa2b21d2f06f87d6f3d3cd517d78c2 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Mon, 19 Mar 2018 22:45:17 +0000 Subject: [PATCH] Make sure listeners are notified of start cancellation. Start cancellation was only working for process-based services. --- src/baseproc-service.cc | 3 ++- src/service.cc | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/baseproc-service.cc b/src/baseproc-service.cc index 7f363a5..61c8270 100644 --- a/src/baseproc-service.cc +++ b/src/baseproc-service.cc @@ -263,6 +263,7 @@ bool base_process_service::interrupt_start() noexcept else { log(loglevel_t::WARN, "Interrupting start of service ", get_name(), " with pid ", pid, " (with SIGINT)."); kill_pg(SIGINT); + if (stop_timeout != time_val(0,0)) { restart_timer.arm_timer_rel(event_loop, stop_timeout); stop_timer_armed = true; @@ -271,8 +272,8 @@ bool base_process_service::interrupt_start() noexcept restart_timer.stop_timer(event_loop); stop_timer_armed = false; } + set_state(service_state_t::STOPPING); - notify_listeners(service_event_t::STARTCANCELLED); return false; } } diff --git a/src/service.cc b/src/service.cc index bfa5924..bf74436 100644 --- a/src/service.cc +++ b/src/service.cc @@ -470,6 +470,7 @@ void service_record::do_stop() noexcept if (! interrupt_start()) { // Now wait for service startup to actually end; we don't need to handle it here. + notify_listeners(service_event_t::STARTCANCELLED); return; } } -- 2.25.1