Fix: reset consumer destination when changing URIs
authorDavid Goulet <dgoulet@efficios.com>
Thu, 11 Apr 2013 19:24:01 +0000 (15:24 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 11 Apr 2013 20:19:11 +0000 (16:19 -0400)
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 <dgoulet@efficios.com>
src/bin/lttng-sessiond/cmd.c

index 9ef1fde3694eddd90b67d18c3aa68d410d309a27..f130f5ebfb17f74f10ec87b1d784359504e99d63 100644 (file)
@@ -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) {
This page took 0.027704 seconds and 4 git commands to generate.