From: Julien Desfossez Date: Sun, 30 Aug 2015 17:02:42 +0000 (-0400) Subject: Store the relay protocol version in the consumer_output X-Git-Tag: v2.8.0-rc1~83 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b31610f2294a6a827fa2d0d19d71199567db8dc5;p=lttng-tools.git Store the relay protocol version in the consumer_output 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 Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index f35043fa4..1ee0c98f9 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -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: diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index fcda59363..395657066 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -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) { diff --git a/src/bin/lttng-sessiond/consumer.h b/src/bin/lttng-sessiond/consumer.h index c84d85140..18d989809 100644 --- a/src/bin/lttng-sessiond/consumer.h +++ b/src/bin/lttng-sessiond/consumer.h @@ -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.