Store the relay protocol version in the consumer_output
authorJulien Desfossez <jdesfossez@efficios.com>
Sun, 30 Aug 2015 17:02:42 +0000 (13:02 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 11 Mar 2016 04:33:42 +0000 (23:33 -0500)
This allows the sessiond to know which version of the protocol is
currently in use with the relay (useful for the metadata regeneration
checks).

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/consumer.c
src/bin/lttng-sessiond/consumer.h

index f35043fa46d52a8d6709ece90028c67b72fdb1b9..1ee0c98f99dadc3516714409aa20164f44f552ff 100644 (file)
@@ -803,7 +803,8 @@ error:
  * Else, it's stays untouched and a lttcomm error code is returned.
  */
 static int create_connect_relayd(struct lttng_uri *uri,
-               struct lttcomm_relayd_sock **relayd_sock)
+               struct lttcomm_relayd_sock **relayd_sock,
+               struct consumer_output *consumer)
 {
        int ret;
        struct lttcomm_relayd_sock *rsock;
@@ -839,6 +840,8 @@ static int create_connect_relayd(struct lttng_uri *uri,
                        ret = LTTNG_ERR_RELAYD_VERSION_FAIL;
                        goto close_sock;
                }
+               consumer->relay_major_version = rsock->major;
+               consumer->relay_minor_version = rsock->minor;
        } else if (uri->stype == LTTNG_STREAM_DATA) {
                DBG3("Creating relayd data socket from URI");
        } else {
@@ -874,7 +877,7 @@ static int send_consumer_relayd_socket(enum lttng_domain_type domain,
        struct lttcomm_relayd_sock *rsock = NULL;
 
        /* Connect to relayd and make version check if uri is the control. */
-       ret = create_connect_relayd(relayd_uri, &rsock);
+       ret = create_connect_relayd(relayd_uri, &rsock, consumer);
        if (ret != LTTNG_OK) {
                goto error;
        }
@@ -1009,6 +1012,10 @@ int cmd_setup_relayd(struct ltt_session *session)
                        /* Session is now ready for network streaming. */
                        session->net_handle = 1;
                }
+               session->consumer->relay_major_version =
+                       usess->consumer->relay_major_version;
+               session->consumer->relay_minor_version =
+                       usess->consumer->relay_minor_version;
        }
 
        if (ksess && ksess->consumer && ksess->consumer->type == CONSUMER_DST_NET
@@ -1027,6 +1034,10 @@ int cmd_setup_relayd(struct ltt_session *session)
                        /* Session is now ready for network streaming. */
                        session->net_handle = 1;
                }
+               session->consumer->relay_major_version =
+                       ksess->consumer->relay_major_version;
+               session->consumer->relay_minor_version =
+                       ksess->consumer->relay_minor_version;
        }
 
 error:
index fcda59363dfb23019aa793dd244c400c044296de..395657066847944742c6a7a86c72254c0e048022 100644 (file)
@@ -563,6 +563,8 @@ struct consumer_output *consumer_copy_output(struct consumer_output *obj)
        output->net_seq_index = obj->net_seq_index;
        memcpy(output->subdir, obj->subdir, PATH_MAX);
        output->snapshot = obj->snapshot;
+       output->relay_major_version = obj->relay_major_version;
+       output->relay_minor_version = obj->relay_minor_version;
        memcpy(&output->dst, &obj->dst, sizeof(output->dst));
        ret = consumer_copy_sockets(output, obj);
        if (ret < 0) {
index c84d85140a03dc647695edc6ea190b7281757146..18d989809d4fed93823675df2c10abd338bc018c 100644 (file)
@@ -153,6 +153,9 @@ struct consumer_output {
         * index. The relayd sockets are index with it on the consumer side.
         */
        uint64_t net_seq_index;
+       /* Store the relay protocol in use if the session is remote. */
+       uint32_t relay_major_version;
+       uint32_t relay_minor_version;
 
        /*
         * Subdirectory path name used for both local and network consumer.
This page took 0.030034 seconds and 4 git commands to generate.