Add snapshot command to lttng UI
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index a23a2b761eac462a4b48869a36b5138a3b71413f..bcf349f9290476de0268dce0e9a535e331d6dedc 100644 (file)
@@ -606,10 +606,11 @@ close_sock:
 error:
        if (ret != LTTNG_OK) {
                /*
-                * On error, nullify the consumer sequence index so streams are not
-                * associated with it once sent to the consumer.
+                * The consumer output for this session should not be used anymore
+                * since the relayd connection failed thus making any tracing or/and
+                * streaming not usable.
                 */
-               uatomic_set(&consumer->net_seq_index, -1);
+               consumer->enabled = 0;
        }
        return ret;
 }
@@ -856,6 +857,15 @@ int cmd_enable_channel(struct ltt_session *session,
 
        DBG("Enabling channel %s for session %s", attr->name, session->name);
 
+       /*
+        * Don't try to enable a channel if the session has been started at
+        * some point in time before. The tracer does not allow it.
+        */
+       if (session->started) {
+               ret = LTTNG_ERR_TRACE_ALREADY_STARTED;
+               goto error;
+       }
+
        rcu_read_lock();
 
        switch (domain->type) {
@@ -876,18 +886,6 @@ int cmd_enable_channel(struct ltt_session *session,
                }
 
                kernel_wait_quiescent(kernel_tracer_fd);
-
-               /*
-                * If the session was previously started, start as well this newly
-                * created kernel session so the events/channels enabled *after* the
-                * start actually work.
-                */
-               if (session->started && !session->kernel_session->started) {
-                       ret = start_kernel_session(session->kernel_session, wpipe);
-                       if (ret != LTTNG_OK) {
-                               goto error;
-                       }
-               }
                break;
        }
        case LTTNG_DOMAIN_UST:
@@ -902,17 +900,6 @@ int cmd_enable_channel(struct ltt_session *session,
                } else {
                        ret = channel_ust_enable(usess, uchan);
                }
-
-               /* Start the UST session if the session was already started. */
-               if (session->started && !usess->start_trace) {
-                       ret = ust_app_start_trace_all(usess);
-                       if (ret < 0) {
-                               ret = LTTNG_ERR_UST_START_FAIL;
-                               goto error;
-                       }
-                       ret = LTTNG_OK;
-                       usess->start_trace = 1;
-               }
                break;
        }
        default:
@@ -1616,8 +1603,6 @@ int cmd_stop_trace(struct ltt_session *session)
                }
        }
 
-       session->started = 0;
-
        ret = LTTNG_OK;
 
 error:
This page took 0.024478 seconds and 4 git commands to generate.