Implement the relayd live features
[lttng-tools.git] / src / bin / lttng-sessiond / consumer.c
index befc5d6dcf95c2dd441412e132a5f2c58158acf4..f0870e6b0c0abcf2ae50e83c32df5ef2b162a33e 100644 (file)
@@ -28,6 +28,7 @@
 #include <common/common.h>
 #include <common/defaults.h>
 #include <common/uri.h>
+#include <common/relayd/relayd.h>
 
 #include "consumer.h"
 #include "health.h"
@@ -939,7 +940,8 @@ error:
  */
 int consumer_send_relayd_socket(struct consumer_socket *consumer_sock,
                struct lttcomm_relayd_sock *rsock, struct consumer_output *consumer,
-               enum lttng_stream_type type, uint64_t session_id)
+               enum lttng_stream_type type, uint64_t session_id,
+               char *session_name, char *hostname, int session_live_timer)
 {
        int ret;
        struct lttcomm_consumer_msg msg;
@@ -955,6 +957,17 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock,
                goto error;
        }
 
+       if (type == LTTNG_STREAM_CONTROL) {
+               ret = relayd_create_session(rsock,
+                               &msg.u.relayd_sock.relayd_session_id,
+                               session_name, hostname, session_live_timer);
+               if (ret < 0) {
+                       /* Close the control socket. */
+                       (void) relayd_close(rsock);
+                       goto error;
+               }
+       }
+
        msg.cmd_type = LTTNG_CONSUMER_ADD_RELAYD_SOCKET;
        /*
         * Assign network consumer output index using the temporary consumer since
This page took 0.02278 seconds and 4 git commands to generate.