Fix: src.ctf.lttng-live: expect NEW_STREAM/METADATA for inactive streams
[babeltrace.git] / src / plugins / ctf / lttng-live / viewer-connection.cpp
index 41e81ec8e07c9e0e6255dc6350b0d27f0f9014cf..5ea98cdda21d4c62a1116dac32cc9e29218f06f8 100644 (file)
@@ -5,25 +5,19 @@
  * Copyright 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  */
 
-#include <fcntl.h>
 #include <glib.h>
 #include <stdint.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <unistd.h>
 
 #include <babeltrace2/babeltrace.h>
 
 #define BT_COMP_LOG_SELF_COMP (viewer_connection->self_comp)
-#define BT_LOG_OUTPUT_LEVEL   (viewer_connection->log_level)
+#define BT_LOG_OUTPUT_LEVEL   ((enum bt_log_level) viewer_connection->log_level)
 #define BT_LOG_TAG            "PLUGIN/SRC.CTF.LTTNG-LIVE/VIEWER"
 #include "logging/comp-logging.h"
 
 #include "common/common.h"
-#include "compat/compiler.h"
-#include "compat/endian.h"
-#include "compat/socket.h"
+#include "compat/endian.h" /* IWYU pragma: keep  */
 
 #include "data-stream.hpp"
 #include "lttng-live.hpp"
@@ -1417,6 +1411,14 @@ lttng_live_get_next_index(struct lttng_live_msg_iter *lttng_live_msg_iter,
     BT_COMP_LOGD("Received response from relay daemon: cmd=%s, response=%s",
                  lttng_viewer_command_string(LTTNG_VIEWER_GET_NEXT_INDEX),
                  lttng_viewer_next_index_return_code_string(rp_status));
+
+    if (flags & LTTNG_VIEWER_FLAG_NEW_STREAM) {
+        BT_COMP_LOGD("Marking all sessions as possibly needing new streams: "
+                     "response=%s, response-flag=NEW_STREAM",
+                     lttng_viewer_next_index_return_code_string(rp_status));
+        lttng_live_need_new_streams(lttng_live_msg_iter);
+    }
+
     switch (rp_status) {
     case LTTNG_VIEWER_INDEX_INACTIVE:
     {
@@ -1448,7 +1450,6 @@ lttng_live_get_next_index(struct lttng_live_msg_iter *lttng_live_msg_iter,
             stream->ctf_stream_class_id.value = ctf_stream_class_id;
             stream->ctf_stream_class_id.is_set = true;
         }
-
         lttng_live_stream_iterator_set_state(stream, LTTNG_LIVE_STREAM_ACTIVE_DATA);
 
         if (flags & LTTNG_VIEWER_FLAG_NEW_METADATA) {
@@ -1457,12 +1458,6 @@ lttng_live_get_next_index(struct lttng_live_msg_iter *lttng_live_msg_iter,
                          lttng_viewer_next_index_return_code_string(rp_status), trace->id);
             trace->metadata_stream_state = LTTNG_LIVE_METADATA_STREAM_STATE_NEEDED;
         }
-        if (flags & LTTNG_VIEWER_FLAG_NEW_STREAM) {
-            BT_COMP_LOGD("Marking all sessions as possibly needing new streams: "
-                         "response=%s, response-flag=NEW_STREAM",
-                         lttng_viewer_next_index_return_code_string(rp_status));
-            lttng_live_need_new_streams(lttng_live_msg_iter);
-        }
         status = LTTNG_LIVE_ITERATOR_STATUS_OK;
         break;
     }
@@ -1490,6 +1485,7 @@ lttng_live_get_next_index(struct lttng_live_msg_iter *lttng_live_msg_iter,
         status = LTTNG_LIVE_ITERATOR_STATUS_ERROR;
         goto end;
     }
+
     goto end;
 
 error:
This page took 0.030285 seconds and 4 git commands to generate.