Fix: Send remove channel to notification thread only when necessary
[lttng-tools.git] / src / bin / lttng-sessiond / kernel-consumer.c
index a65e1493c384ea75401266b019b56ab605ce7e89..0f59aa24f51decc781c760ddef1007399851355d 100644 (file)
@@ -168,6 +168,9 @@ int kernel_consumer_add_channel(struct consumer_socket *sock,
                ret = -1;
                goto error;
        }
+
+       channel->published_to_notification_thread = true;
+
 error:
        free(pathname);
        return ret;
@@ -338,7 +341,7 @@ int kernel_consumer_send_channel_stream(struct consumer_socket *sock,
                struct ltt_kernel_channel *channel, struct ltt_kernel_session *session,
                unsigned int monitor)
 {
-       int ret;
+       int ret = LTTNG_OK;
        struct ltt_kernel_stream *stream;
 
        /* Safety net */
@@ -356,9 +359,12 @@ int kernel_consumer_send_channel_stream(struct consumer_socket *sock,
        DBG("Sending streams of channel %s to kernel consumer",
                        channel->channel->name);
 
-       ret = kernel_consumer_add_channel(sock, channel, session, monitor);
-       if (ret < 0) {
-               goto error;
+       if (!channel->sent_to_consumer) {
+               ret = kernel_consumer_add_channel(sock, channel, session, monitor);
+               if (ret < 0) {
+                       goto error;
+               }
+               channel->sent_to_consumer = true;
        }
 
        /* Send streams */
This page took 0.023094 seconds and 4 git commands to generate.