Adjust the relayd protocol on version check
[lttng-tools.git] / src / bin / lttng-sessiond / consumer.c
index 57b5b19d17db507b6b42d5407be7535512236e1e..f803f7b0553c19c0458d387ae8b03a73a1969417 100644 (file)
@@ -663,7 +663,9 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                uint64_t relayd_id,
                uint64_t key,
                unsigned char *uuid,
-               uint32_t chan_id)
+               uint32_t chan_id,
+               uint64_t tracefile_size,
+               uint64_t tracefile_count)
 {
        assert(msg);
 
@@ -684,6 +686,8 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
        msg->u.ask_channel.relayd_id = relayd_id;
        msg->u.ask_channel.key = key;
        msg->u.ask_channel.chan_id = chan_id;
+       msg->u.ask_channel.tracefile_size = tracefile_size;
+       msg->u.ask_channel.tracefile_count = tracefile_count;
 
        memcpy(msg->u.ask_channel.uuid, uuid, sizeof(msg->u.ask_channel.uuid));
 
@@ -709,7 +713,9 @@ void consumer_init_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                const char *name,
                unsigned int nb_init_streams,
                enum lttng_event_output output,
-               int type)
+               int type,
+               uint64_t tracefile_size,
+               uint64_t tracefile_count)
 {
        assert(msg);
 
@@ -726,6 +732,8 @@ void consumer_init_channel_comm_msg(struct lttcomm_consumer_msg *msg,
        msg->u.channel.nb_init_streams = nb_init_streams;
        msg->u.channel.output = output;
        msg->u.channel.type = type;
+       msg->u.channel.tracefile_size = tracefile_size;
+       msg->u.channel.tracefile_count = tracefile_count;
 
        strncpy(msg->u.channel.pathname, pathname,
                        sizeof(msg->u.channel.pathname));
@@ -1072,7 +1080,7 @@ end:
 }
 
 /*
- * Send metadata string to consumer.
+ * Send metadata string to consumer. Socket lock MUST be acquired.
  *
  * Return 0 on success else a negative value.
  */
@@ -1093,17 +1101,9 @@ int consumer_push_metadata(struct consumer_socket *socket,
        msg.u.push_metadata.target_offset = target_offset;
        msg.u.push_metadata.len = len;
 
-       /*
-        * TODO: reenable these locks when the consumerd gets the ability to
-        * reorder the metadata it receives. This fits with locking in
-        * src/bin/lttng-sessiond/ust-app.c:push_metadata()
-        *
-        * pthread_mutex_lock(socket->lock);
-        */
-
        health_code_update();
        ret = consumer_send_msg(socket, &msg);
-       if (ret < 0) {
+       if (ret < 0 || len == 0) {
                goto end;
        }
 
@@ -1122,8 +1122,5 @@ int consumer_push_metadata(struct consumer_socket *socket,
 
 end:
        health_code_update();
-       /*
-        * pthread_mutex_unlock(socket->lock);
-        */
        return ret;
 }
This page took 0.029317 seconds and 5 git commands to generate.