Fix last commit. Git code-18 pushed the wrong fix.
authorDavid Goulet <dgoulet@efficios.com>
Fri, 19 Oct 2012 16:39:59 +0000 (12:39 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 19 Oct 2012 16:39:59 +0000 (12:39 -0400)
Fixes #374 #382

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/consumer.h

index d1417efd76e52409be5573497d3ad0010b849ad9..b1e66e755bf0f621fb8c78f84a6d8c9043cedc55 100644 (file)
@@ -522,12 +522,6 @@ static int send_consumer_relayd_socket(int domain, struct ltt_session *session,
        int ret;
        struct lttcomm_sock *sock = NULL;
 
-       /* Don't resend the sockets to the consumer. */
-       if (consumer->dst.net.relayd_socks_sent) {
-               ret = LTTNG_OK;
-               goto error;
-       }
-
        /* Set the network sequence index if not set. */
        if (consumer->net_seq_index == -1) {
                /*
@@ -559,6 +553,13 @@ static int send_consumer_relayd_socket(int domain, struct ltt_session *session,
                goto close_sock;
        }
 
+       /* Flag that the corresponding socket was sent. */
+       if (relayd_uri->stype == LTTNG_STREAM_CONTROL) {
+               consumer->dst.net.control_sock_sent = 1;
+       } else if (relayd_uri->stype == LTTNG_STREAM_DATA) {
+               consumer->dst.net.data_sock_sent = 1;
+       }
+
        ret = LTTNG_OK;
 
        /*
@@ -572,7 +573,6 @@ close_sock:
                lttcomm_destroy_sock(sock);
        }
 
-error:
        return ret;
 }
 
@@ -589,29 +589,24 @@ static int send_consumer_relayd_sockets(int domain,
        assert(session);
        assert(consumer);
 
-       /* Don't resend the sockets to the consumer. */
-       if (consumer->dst.net.relayd_socks_sent) {
-               ret = LTTNG_OK;
-               goto error;
-       }
-
        /* Sending control relayd socket. */
-       ret = send_consumer_relayd_socket(domain, session,
-                       &consumer->dst.net.control, consumer, fd);
-       if (ret != LTTNG_OK) {
-               goto error;
+       if (!consumer->dst.net.control_sock_sent) {
+               ret = send_consumer_relayd_socket(domain, session,
+                               &consumer->dst.net.control, consumer, fd);
+               if (ret != LTTNG_OK) {
+                       goto error;
+               }
        }
 
        /* Sending data relayd socket. */
-       ret = send_consumer_relayd_socket(domain, session,
-                       &consumer->dst.net.data, consumer, fd);
-       if (ret != LTTNG_OK) {
-               goto error;
+       if (!consumer->dst.net.data_sock_sent) {
+               ret = send_consumer_relayd_socket(domain, session,
+                               &consumer->dst.net.data, consumer, fd);
+               if (ret != LTTNG_OK) {
+                       goto error;
+               }
        }
 
-       /* Flag that all relayd sockets were sent to the consumer. */
-       consumer->dst.net.relayd_socks_sent = 1;
-
 error:
        return ret;
 }
@@ -1601,10 +1596,13 @@ int cmd_set_consumer_uri(int domain, struct ltt_session *session,
 
                /*
                 * Don't send relayd socket if URI is NOT remote or if the relayd
-                * sockets for the session are already sent.
+                * socket for the session was already sent.
                 */
                if (uris[i].dtype == LTTNG_DST_PATH ||
-                               consumer->dst.net.relayd_socks_sent) {
+                               (uris[i].stype == LTTNG_STREAM_CONTROL &&
+                               consumer->dst.net.control_sock_sent) ||
+                               (uris[i].stype == LTTNG_STREAM_DATA &&
+                               consumer->dst.net.data_sock_sent)) {
                        continue;
                }
 
index ec4ef3f3162533be8b0f98880eac41dde943e013..6855068dbedc86162acdeb00b8328db3aa808732 100644 (file)
@@ -112,7 +112,8 @@ struct consumer_net {
        struct lttng_uri data;
 
        /* Flag if network sockets were sent to the consumer. */
-       unsigned int relayd_socks_sent;
+       unsigned int control_sock_sent;
+       unsigned int data_sock_sent;
 };
 
 /*
This page took 0.029604 seconds and 4 git commands to generate.