From: David Goulet Date: Fri, 17 Aug 2012 19:03:39 +0000 (-0400) Subject: Fix relayd version check and remove unused code X-Git-Tag: v2.1.0-rc1~4 X-Git-Url: https://git.lttng.org/?a=commitdiff_plain;ds=sidebyside;h=0a6b5085547c16fe3a62e6a6f68bebf9349ce706;p=lttng-tools.git Fix relayd version check and remove unused code Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index 77e314d95..cb115afda 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -1248,7 +1248,8 @@ int relay_send_version(struct lttcomm_relayd_hdr *recv_hdr, if (ret < 0) { ERR("Relay sending version"); } - DBG("Version check done"); + DBG("Version check done (%u.%u)", be32toh(reply.major), + be32toh(reply.minor)); end: return ret; diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 8cd9d4c57..c952fc0a9 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -2001,7 +2001,8 @@ static int create_connect_relayd(struct consumer_output *output, DBG3("Creating relayd stream socket from URI"); /* Check relayd version */ - ret = relayd_version_check(sock, LTTNG_UST_COMM_MAJOR, 0); + ret = relayd_version_check(sock, RELAYD_VERSION_COMM_MAJOR, + RELAYD_VERSION_COMM_MINOR); if (ret < 0) { ret = LTTCOMM_RELAYD_VERSION_FAIL; goto close_sock; diff --git a/src/common/relayd/relayd.c b/src/common/relayd/relayd.c index 7e99dbb67..f79555fa8 100644 --- a/src/common/relayd/relayd.c +++ b/src/common/relayd/relayd.c @@ -97,58 +97,6 @@ error: return ret; } -#if 0 -/* - * Create session on the relayd. - * - * On error, return ret_code negative value else return 0. - */ -int relayd_create_session(struct lttcomm_sock *sock, const char *hostname, - const char *session_name) -{ - int ret; - struct lttcomm_relayd_create_session msg; - struct lttcomm_relayd_generic_reply reply; - - /* Code flow error. Safety net. */ - assert(sock); - assert(hostname); - assert(session_name); - - DBG("Relayd creating session for hostname %s and session name %s", - hostname, session_name); - - strncpy(msg.hostname, hostname, sizeof(msg.hostname)); - strncpy(msg.session_name, session_name, sizeof(msg.session_name)); - - /* Send command */ - ret = send_command(sock, RELAYD_CREATE_SESSION, (void *) &msg, - sizeof(msg), 0); - if (ret < 0) { - goto error; - } - - /* Recevie response */ - ret = recv_reply(sock, (void *) &reply, sizeof(reply)); - if (ret < 0) { - goto error; - } - - /* Return session id or negative ret code. */ - if (reply.ret_code != LTTCOMM_OK) { - ret = -reply.ret_code; - } else { - /* Success */ - ret = 0; - } - - DBG2("Relayd created session for %s", session_name); - -error: - return ret; -} -#endif - /* * Add stream on the relayd and assign stream handle to the stream_id argument. * @@ -255,47 +203,6 @@ error: return ret; } -#if 0 -/* - * Start data command on the relayd. - * - * On success return 0 else return ret_code negative value. - */ -int relayd_start_data(struct lttcomm_sock *sock) -{ - int ret; - struct lttcomm_relayd_generic_reply reply; - - /* Code flow error. Safety net. */ - assert(sock); - - DBG("Relayd start data command"); - - /* Send command */ - ret = send_command(sock, RELAYD_START_DATA, NULL, 0, 0); - if (ret < 0) { - goto error; - } - - /* Recevie response */ - ret = recv_reply(sock, (void *) &reply, sizeof(reply)); - if (ret < 0) { - goto error; - } - - /* Return session id or negative ret code. */ - if (reply.ret_code != LTTCOMM_OK) { - ret = -reply.ret_code; - } else { - /* Success */ - ret = 0; - } - -error: - return ret; -} -#endif - /* * Add stream on the relayd and assign stream handle to the stream_id argument. * diff --git a/src/common/sessiond-comm/relayd.h b/src/common/sessiond-comm/relayd.h index c025fcdd9..24b7c912f 100644 --- a/src/common/sessiond-comm/relayd.h +++ b/src/common/sessiond-comm/relayd.h @@ -26,6 +26,9 @@ #include +#define RELAYD_VERSION_COMM_MAJOR 2 +#define RELAYD_VERSION_COMM_MINOR 1 + /* * lttng-relayd communication header. */