main-afb-daemon: Kill child instead of it
[src/app-framework-binder.git] / src / main-afb-daemon.c
index 8b1a2b2..c120446 100644 (file)
 #include "afb-hook.h"
 #include "afb-debug.h"
 #include "process-name.h"
-#include "afb-supervision.h"
+#if defined(WITH_SUPERVISION)
+#   include "afb-supervision.h"
+#endif
 
 /*
    if SELF_PGROUP == 0 the launched command is the group leader
    if SELF_PGROUP != 0 afb-daemon is the group leader
 */
-#define SELF_PGROUP 1
+#define SELF_PGROUP 0
 
 struct afb_apiset *main_apiset;
 struct afb_config *main_config;
@@ -577,10 +579,12 @@ static void start(int signum, void *arg)
                ERROR("failed to setup monitor");
                goto error;
        }
-       if (afb_supervision_init() < 0) {
+#if defined(WITH_SUPERVISION)
+       if (afb_supervision_init(main_apiset, main_config) < 0) {
                ERROR("failed to setup supervision");
                goto error;
        }
+#endif
 
        /* install hooks */
        if (main_config->tracereq)
@@ -601,8 +605,7 @@ static void start(int signum, void *arg)
        apiset_start_list(main_config->ws_clients, afb_api_ws_add_client_weak, "the afb-websocket client");
        apiset_start_list(main_config->ldpaths, afb_api_so_add_pathset_fails, "the binding path set");
        apiset_start_list(main_config->weak_ldpaths, afb_api_so_add_pathset_nofails, "the weak binding path set");
-       apiset_start_list(main_config->auto_ws, afb_autoset_add_ws, "the automatic afb-websocket path set");
-       apiset_start_list(main_config->auto_link, afb_autoset_add_so, "the automatic link binding path set");
+       apiset_start_list(main_config->auto_api, afb_autoset_add_any, "the automatic api path set");
 
 #if defined(WITH_DBUS_TRANSPARENCY)
        apiset_start_list(main_config->dbus_servers, afb_api_dbus_add_server, "the afb-dbus service");
@@ -662,9 +665,6 @@ int main(int argc, char *argv[])
 {
        afb_debug("main-entry");
 
-       // let's run this program with a low priority
-       nice(20);
-
        // ------------- Build session handler & init config -------
        main_config = afb_config_parse_arguments(argc, argv);
        if (main_config->name) {