aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denys@konsulko.com>2023-04-11 01:33:09 +0000
committerDenys Dmytriyenko <denys@konsulko.com>2023-04-13 22:03:46 +0000
commit5cab14e6a98519e0b6c6043a1a19e42f094d6522 (patch)
tree1d06850bea32c467d8d5ac26b70f20183c43ba39
parentc52afaf8b5c96136fe20e5d5a1332121d3b09ee9 (diff)
Handle "failed" signal
When application exits abnormally, it emits "failed" signal, instead of "inactive" one. Handle it accordingly, so the internal state doesn't get out of sync and prevents starting the app again. Bug-AGL: SPEC-4199 Signed-off-by: Denys Dmytriyenko <denys@konsulko.com> Change-Id: I307a6c6973f98d8f57af477bc03ebfb1218559db
-rw-r--r--src/systemd_manager.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/systemd_manager.c b/src/systemd_manager.c
index e6d67f8..7eba643 100644
--- a/src/systemd_manager.c
+++ b/src/systemd_manager.c
@@ -363,6 +363,15 @@ static void unit_properties_changed_cb(GDBusProxy *proxy,
g_signal_emit(data->mgr, signals[STARTED], 0, app_info_get_app_id(app_info));
}
}
+ else if(!g_strcmp0(new_state, "failed"))
+ {
+ g_debug("Application %s has failed", app_info_get_app_id(app_info));
+ app_info_set_status(app_info, APP_STATUS_INACTIVE);
+ app_info_set_runtime_data(app_info, NULL);
+
+ g_signal_emit(data->mgr, signals[TERMINATED], 0, app_info_get_app_id(app_info));
+ systemd_manager_free_runtime_data(data);
+ }
g_free(new_state);
}