From df75acaceaceb383f558a251dca3703b6593ce40 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Thu, 11 Apr 2013 15:24:01 -0400 Subject: [PATCH] Fix: reset consumer destination when changing URIs Using -C and -D with lttng create, the session if first created with the default file path and then changed to the relayd URIs. The destination object was not reset which was causing a corruption to the state of the consumer object. Signed-off-by: David Goulet --- src/bin/lttng-sessiond/cmd.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 9ef1fde36..f130f5ebf 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -380,16 +380,20 @@ static int add_uri_to_consumer(struct consumer_output *consumer, case LTTNG_DST_IPV6: DBG2("Setting network URI to consumer"); - consumer->type = CONSUMER_DST_NET; - - if ((uri->stype == LTTNG_STREAM_CONTROL && + if (consumer->type == CONSUMER_DST_NET) { + if ((uri->stype == LTTNG_STREAM_CONTROL && consumer->dst.net.control_isset) || (uri->stype == LTTNG_STREAM_DATA && consumer->dst.net.data_isset)) { - ret = LTTNG_ERR_URL_EXIST; - goto error; + ret = LTTNG_ERR_URL_EXIST; + goto error; + } + } else { + memset(&consumer->dst.net, 0, sizeof(consumer->dst.net)); } + consumer->type = CONSUMER_DST_NET; + /* Set URI into consumer output object */ ret = consumer_set_network_uri(consumer, uri); if (ret < 0) { -- 2.34.1