Simply close socket when application registration is refused
[lttng-tools.git] / lttng-sessiond / main.c
index 9464c2c1b8e0f4f3d17ef300cf15975d2174c6ec..54dcbdff06f68965b8f2923160825e180bfe65c9 100644 (file)
@@ -305,8 +305,14 @@ static void teardown_kernel_session(struct ltt_session *session)
  */
 static void teardown_ust_session(struct ltt_session *session)
 {
+       int ret;
+
        DBG("Tearing down UST session(s)");
 
+       ret = ust_app_destroy_trace_all(session->ust_session);
+       if (ret) {
+               ERR("Error in ust_app_destroy_trace_all");
+       }
        trace_ust_destroy_session(session->ust_session);
 }
 
@@ -1054,9 +1060,10 @@ static void *thread_manage_apps(void *data)
                                        /* Register applicaton to the session daemon */
                                        ret = ust_app_register(&ust_cmd.reg_msg,
                                                        ust_cmd.sock);
-                                       if (ret < 0) {
-                                               /* Only critical ENOMEM error can be returned here */
+                                       if (ret == -ENOMEM) {
                                                goto error;
+                                       } else if (ret < 0) {
+                                               break;
                                        }
 
                                        /*
@@ -2676,6 +2683,8 @@ static int cmd_destroy_session(struct ltt_session *session, char *name)
 
        /* Clean kernel session teardown */
        teardown_kernel_session(session);
+       /* UST session teardown */
+       teardown_ust_session(session);
 
        /*
         * Must notify the kernel thread here to update it's poll setin order
@@ -2814,14 +2823,14 @@ static ssize_t cmd_list_channels(int domain, struct ltt_session *session,
                if (session->kernel_session != NULL) {
                        nb_chan = session->kernel_session->channel_count;
                }
-               DBG3("Number of kernel channels %ld", nb_chan);
+               DBG3("Number of kernel channels %zd", nb_chan);
                break;
        case LTTNG_DOMAIN_UST:
                if (session->ust_session != NULL) {
                        nb_chan = hashtable_get_count(
                                        session->ust_session->domain_global.channels);
                }
-               DBG3("Number of UST global channels %ld", nb_chan);
+               DBG3("Number of UST global channels %zd", nb_chan);
                break;
        default:
                *channels = NULL;
This page took 0.024042 seconds and 4 git commands to generate.