* 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 <glib.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.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 (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/compiler.h"
+#include "compat/endian.h"
+#include "compat/socket.h"
+#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;
* }
*/
-BT_HIDDEN
bt_component_class_query_method_status
live_viewer_connection_list_sessions(struct live_viewer_connection *viewer_connection,
const bt_value **user_result)
return status;
}
-BT_HIDDEN
enum lttng_live_viewer_status
lttng_live_create_viewer_session(struct lttng_live_msg_iter *lttng_live_msg_iter)
{
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;
return status;
}
-BT_HIDDEN
enum lttng_live_viewer_status lttng_live_session_attach(struct lttng_live_session *session,
bt_self_message_iterator *self_msg_iter)
{
return status;
}
-BT_HIDDEN
enum lttng_live_viewer_status lttng_live_session_detach(struct lttng_live_session *session)
{
struct lttng_viewer_cmd cmd;
return status;
}
-BT_HIDDEN
enum lttng_live_get_one_metadata_status
lttng_live_get_one_metadata_packet(struct lttng_live_trace *trace, FILE *fp, size_t *reply_len)
{
}
len = be64toh(rp.len);
+ if (len == 0) {
+ /*
+ * We received a `LTTNG_VIEWER_METADATA_OK` with a packet
+ * length of 0. This means we must try again. This scenario
+ * arises when a clear command is performed on an lttng session.
+ */
+ BT_COMP_LOGD(
+ "Expecting a metadata packet of size 0. Retry to get a packet from the relay.");
+ goto empty_metadata_packet_retry;
+ }
+
BT_COMP_LOGD("Writing %" PRIu64 " bytes to metadata", len);
if (len <= 0) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp, "Erroneous response length");
goto end;
}
+empty_metadata_packet_retry:
*reply_len = len;
status = LTTNG_LIVE_GET_ONE_METADATA_STATUS_OK;
}
}
-BT_HIDDEN
enum lttng_live_iterator_status
lttng_live_get_next_index(struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *stream, struct packet_index *index)
return status;
}
-BT_HIDDEN
enum ctf_msg_iter_medium_status
lttng_live_get_stream_bytes(struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *stream, uint8_t *buf,
/*
* Request new streams for a session.
*/
-BT_HIDDEN
enum lttng_live_iterator_status
lttng_live_session_get_new_streams(struct lttng_live_session *session,
bt_self_message_iterator *self_msg_iter)
return status;
}
-BT_HIDDEN
enum lttng_live_viewer_status live_viewer_connection_create(
bt_self_component *self_comp, bt_self_component_class *self_comp_class,
bt_logging_level log_level, const char *url, bool in_query,
return status;
}
-BT_HIDDEN
void live_viewer_connection_destroy(struct live_viewer_connection *viewer_connection)
{
bt_self_component *self_comp = viewer_connection->self_comp;