- // note this is sync, so this might block if afm-system-daemon is down
- afm_proxy.ps(request->api, &jobj);
-
- if (jobj) {
- const int len = json_object_array_length(jobj);
- for (int i = 0; i < len; i++) {
- struct json_object *aid;
- struct json_object *item =
- json_object_array_get_idx(jobj, i);
-
- bool isFound = json_object_object_get_ex(item, "id", &aid);
- if (isFound) {
- const char *str_appid = json_object_get_string(aid);
- if (strcmp(str_appid, id.c_str()) == 0) {
- app_still_running = true;
- break;
- }
- }
- }
+ // this will always be case as the removeClientCtxt() is never called as
+ // clients do not handle the subscribe at all at this point. Not only that
+ // but is redudant but we keep at as it to highlight the fact that we're
+ // missing a feature to check if applications died or not (legitimate or not).
+ //
+ // Using ps (HS_AfmMainProxy::ps -- a sync version of checking if running
+ // applications) seem to block in afm-system-daemon (see SPEC-3902), and
+ // doing w/ it with an async version of ps doesn't work because we don't
+ // have a valid clientCtx (required, and only possible if the application
+ // subscribed themselves, which no longer happens)
+ //
+ // FIXME: We need another way of handling this would be necessary to correctly
+ // handle the case where the app died.
+ if (ip != client_list.end()) {
+ app_still_running = true;