*
* Returns LTTNG_OK on success or an LTTng error code on failure.
*/
-static enum lttng_error_code send_consumer_relayd_socket(unsigned int session_id,
+static enum lttng_error_code send_consumer_relayd_socket(const struct ltt_session& session,
struct lttng_uri *relayd_uri,
struct consumer_output *consumer,
struct consumer_socket *consumer_sock,
- const char *session_name,
- const char *hostname,
- const char *base_path,
- int session_live_timer,
+ const char *base_path_override,
const uint64_t *current_chunk_id,
- time_t session_creation_time,
- bool session_name_contains_creation_time,
struct lttcomm_relayd_sock& rsock)
{
int ret;
/* Send relayd socket to consumer. */
ret = consumer_send_relayd_socket(consumer_sock, &rsock, consumer, relayd_uri->stype,
- session_id, session_name, hostname, base_path, session_live_timer,
- current_chunk_id, session_creation_time,
- session_name_contains_creation_time);
+ session, base_path_override, current_chunk_id);
if (ret < 0) {
status = LTTNG_ERR_ENABLE_CONSUMER_FAIL;
goto error;
static lttng_error_code send_consumer_relayd_sockets(const ltt_session& session,
struct consumer_output *consumer,
struct consumer_socket *sock,
- const char *base_path,
+ const char *base_path_override,
const uint64_t *current_chunk_id)
{
enum lttng_error_code status = LTTNG_OK;
goto error;
}
- status = send_consumer_relayd_socket(session.id, &consumer->dst.net.control,
- consumer, sock, session.name, session.hostname, base_path,
- session.live_timer, current_chunk_id, session.creation_time,
- session.name_contains_creation_time, *control_sock);
+ status = send_consumer_relayd_socket(session, &consumer->dst.net.control, consumer,
+ sock, base_path_override, current_chunk_id, *control_sock);
if (status != LTTNG_OK) {
goto error;
}
LTTNG_ASSERT(data_sock);
- status = send_consumer_relayd_socket(session.id, &consumer->dst.net.data, consumer,
- sock, session.name, session.hostname, base_path, session.live_timer,
- current_chunk_id, session.creation_time,
- session.name_contains_creation_time, *data_sock);
+ status = send_consumer_relayd_socket(session, &consumer->dst.net.data, consumer,
+ sock, base_path_override, current_chunk_id, *data_sock);
if (status != LTTNG_OK) {
goto error;
cds_lfht_for_each_entry (
usess->consumer->socks->ht, &iter.iter, socket, node.node) {
pthread_mutex_lock(socket->lock);
- ret = send_consumer_relayd_sockets(*session, usess->consumer, socket,
- session->base_path,
+ ret = send_consumer_relayd_sockets(*session, usess->consumer, socket, NULL,
current_chunk_id.is_set ? ¤t_chunk_id.value : NULL);
pthread_mutex_unlock(socket->lock);
if (ret != LTTNG_OK) {
cds_lfht_for_each_entry (
ksess->consumer->socks->ht, &iter.iter, socket, node.node) {
pthread_mutex_lock(socket->lock);
- ret = send_consumer_relayd_sockets(*session, ksess->consumer, socket,
- session->base_path,
+ ret = send_consumer_relayd_sockets(*session, ksess->consumer, socket, NULL,
current_chunk_id.is_set ? ¤t_chunk_id.value : NULL);
pthread_mutex_unlock(socket->lock);
if (ret != LTTNG_OK) {
struct lttng_ht_iter iter;
struct consumer_socket *socket;
LTTNG_OPTIONAL(uint64_t) current_chunk_id = {};
- const char *base_path;
+ const char *base_path_override = NULL;
LTTNG_ASSERT(output);
LTTNG_ASSERT(session);
* base path.
*/
if (output->dst.net.control.subdir[0] != '\0') {
- base_path = output->dst.net.control.subdir;
- } else {
- base_path = session->base_path;
+ base_path_override = output->dst.net.control.subdir;
}
/*
rcu_read_lock();
cds_lfht_for_each_entry (output->socks->ht, &iter.iter, socket, node.node) {
pthread_mutex_lock(socket->lock);
- status = send_consumer_relayd_sockets(*session, output, socket, base_path,
+ status = send_consumer_relayd_sockets(*session, output, socket, base_path_override,
current_chunk_id.is_set ? ¤t_chunk_id.value : NULL);
pthread_mutex_unlock(socket->lock);
if (status != LTTNG_OK) {
goto end;
}
- if (!(supported_trace_format & trace_format->relayd_type())) {
+ if (!is_trace_format_configuration_supported(
+ supported_trace_format, *trace_format)) {
ERR("Relayd does not support the requested trace format");
ret_code = LTTNG_ERR_TRACE_FORMAT_UNSUPPORTED_RELAY_DAEMON;
goto end;