Fix: bt_common_string_until(): reset returned variable on error
[babeltrace.git] / src / plugins / ctf / lttng-live / viewer-connection.c
index 42ea78c0ad7fd9cca3d4287fff86c91e22960cbd..bc03be54de33b7ed8daf10289a2adaa12834b492 100644 (file)
@@ -24,7 +24,7 @@
 #define BT_COMP_LOG_SELF_COMP (viewer_connection->self_comp)
 #define BT_LOG_OUTPUT_LEVEL (viewer_connection->log_level)
 #define BT_LOG_TAG "PLUGIN/SRC.CTF.LTTNG-LIVE/VIEWER"
-#include "plugins/comp-logging.h"
+#include "logging/comp-logging.h"
 
 #include <stdio.h>
 #include <stdint.h>
@@ -316,7 +316,7 @@ int list_update_session(bt_value *results,
        int i, len;
        bool found = false;
 
-       len = bt_value_array_get_size(results);
+       len = bt_value_array_get_length(results);
        if (len < 0) {
                BT_COMP_LOGE_STR("Error getting size of array.");
                ret = -1;
@@ -573,10 +573,6 @@ bt_component_class_query_method_status live_viewer_connection_list_sessions(
        uint32_t i, sessions_count;
        ssize_t ret_len;
 
-       if (lttng_live_handshake(viewer_connection)) {
-               goto error;
-       }
-
        result = bt_value_array_create();
        if (!result) {
                BT_COMP_LOGE("Error creating array");
@@ -1221,6 +1217,7 @@ enum lttng_live_iterator_status lttng_live_get_next_index(
                index->offset = EOF;
                retstatus = LTTNG_LIVE_ITERATOR_STATUS_END;
                stream->state = LTTNG_LIVE_STREAM_EOF;
+               stream->has_stream_hung_up = true;
                break;
        case LTTNG_VIEWER_INDEX_ERR:
                BT_COMP_LOGE("get_next_index: error");
@@ -1466,18 +1463,23 @@ error:
 BT_HIDDEN
 struct live_viewer_connection *live_viewer_connection_create(
                const char *url, bool in_query,
-               struct lttng_live_msg_iter *lttng_live_msg_iter)
+               struct lttng_live_msg_iter *lttng_live_msg_iter,
+               bt_logging_level log_level)
 {
        struct live_viewer_connection *viewer_connection;
 
        viewer_connection = g_new0(struct live_viewer_connection, 1);
 
-       if (bt_socket_init(lttng_live_msg_iter->log_level) != 0) {
+       if (bt_socket_init(log_level) != 0) {
                goto error;
        }
 
-       viewer_connection->log_level = lttng_live_msg_iter->log_level;
-       viewer_connection->self_comp = lttng_live_msg_iter->self_comp;
+       viewer_connection->log_level = log_level;
+
+       if (lttng_live_msg_iter) {
+               viewer_connection->self_comp = lttng_live_msg_iter->self_comp;
+       }
+
        bt_object_init_shared(&viewer_connection->obj, connection_release);
        viewer_connection->control_sock = BT_INVALID_SOCKET;
        viewer_connection->port = -1;
This page took 0.027306 seconds and 4 git commands to generate.