summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-02-12 12:56:44 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2016-02-12 12:56:44 +0100
commitd7f0ae1fe578e92a1b7c83807683b2b9a9752efe (patch)
tree9f148cfd2fe341c4eeb31a2e6087dda0b1ec6b29
parenta83d46af43d8327604f56aa6938626bfdc744d5d (diff)
afm-system-daemon: send signal before the answer
Change-Id: I96a0886406235a8448e8f07b09a3cdd01aa29021 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afm-system-daemon.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/afm-system-daemon.c b/src/afm-system-daemon.c
index 6a242ea..9cb9433 100644
--- a/src/afm-system-daemon.c
+++ b/src/afm-system-daemon.c
@@ -102,16 +102,15 @@ static void on_install(struct jreq *jreq, struct json_object *req)
resp = json_object_new_object();
if(!resp || !j_add_string(resp, "added", wgt_info_desc(ifo)->idaver))
jbus_reply_error_s(jreq, "\"out of memory but installed!\"");
- else
+ else {
+ jbus_send_signal_s(jbus, "changed", "true");
jbus_reply_j(jreq, resp);
+ }
/* clean-up */
wgt_info_unref(ifo);
json_object_put(resp);
}
-
- /* still sends the signal */
- jbus_send_signal_s(jbus, "changed", "true");
}
static void on_uninstall(struct jreq *jreq, struct json_object *req)
@@ -141,11 +140,10 @@ static void on_uninstall(struct jreq *jreq, struct json_object *req)
rc = uninstall_widget(idaver, root);
if (rc)
jbus_reply_error_s(jreq, "\"uninstallation had error\"");
- else
+ else {
+ jbus_send_signal_s(jbus, "changed", "true");
jbus_reply_s(jreq, "true");
-
- /* still sends the signal */
- jbus_send_signal_s(jbus, "changed", "true");
+ }
}
static int daemonize()