* Copyright 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*/
-#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 "logging/comp-logging.h"
-
-#include <fcntl.h>
-#include <stdbool.h>
+#include <glib.h>
#include <stdint.h>
#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <glib.h>
+#include <babeltrace2/babeltrace.h>
+
+#define BT_COMP_LOG_SELF_COMP (viewer_connection->self_comp)
+#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 "compat/socket.h"
-#include "compat/endian.h"
-#include "compat/compiler.h"
#include "common/common.h"
-#include <babeltrace2/babeltrace.h>
+#include "compat/endian.h" /* IWYU pragma: keep */
+#include "data-stream.hpp"
#include "lttng-live.hpp"
-#include "viewer-connection.hpp"
#include "lttng-viewer-abi.hpp"
-#include "data-stream.hpp"
#include "metadata.hpp"
+#include "viewer-connection.hpp"
#define viewer_handle_send_recv_status(_self_comp, _self_comp_class, _status, _action, _msg_str) \
do { \
char error_buf[256] = {0};
bt_self_component *self_comp = viewer_connection->self_comp;
bt_self_component_class *self_comp_class = viewer_connection->self_comp_class;
- struct bt_common_lttng_live_url_parts lttng_live_url_parts = {0};
+ struct bt_common_lttng_live_url_parts lttng_live_url_parts = {};
int ret = -1;
const char *path = viewer_connection->url->str;
if (stream.metadata_flag) {
BT_COMP_LOGI(" metadata stream %" PRIu64 " : %s/%s", stream_id, stream.path_name,
stream.channel_name);
- if (lttng_live_metadata_create_stream(session, ctf_trace_id, stream_id,
- stream.path_name)) {
+ if (lttng_live_metadata_create_stream(session, ctf_trace_id, stream_id)) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp, "Error creating metadata stream");
status = LTTNG_LIVE_VIEWER_STATUS_ERROR;
goto end;
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:
{
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) {
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;
}
status = LTTNG_LIVE_ITERATOR_STATUS_ERROR;
goto end;
}
+
goto end;
error:
bt_logging_level log_level, const char *url, bool in_query,
struct lttng_live_msg_iter *lttng_live_msg_iter, struct live_viewer_connection **viewer)
{
- struct live_viewer_connection *viewer_connection;
enum lttng_live_viewer_status status;
- viewer_connection = g_new0(struct live_viewer_connection, 1);
+ live_viewer_connection *viewer_connection = new live_viewer_connection;
if (bt_socket_init(log_level) != 0) {
BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE(self_comp, self_comp_class,
g_string_free(viewer_connection->proto, true);
}
- g_free(viewer_connection);
+ delete viewer_connection;
bt_socket_fini();