Fix: use session id when deleting viewer streams
authorDavid Goulet <dgoulet@efficios.com>
Fri, 27 Sep 2013 21:41:42 +0000 (17:41 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 27 Sep 2013 22:28:47 +0000 (18:28 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-relayd/live.c
src/bin/lttng-relayd/lttng-relayd.h

index ee3ecec65f9463b826c63732d6c53ac8dabd149a..cbf32790c88f90d3f7641e05ef1467dd9c76749e 100644 (file)
@@ -689,7 +689,7 @@ int viewer_attach_session(struct relay_command *cmd,
        }
 
        session = caa_container_of(node, struct relay_session, session_n);
-       if (cmd->session == session) {
+       if (cmd->session_id == session->id) {
                /* Same viewer already attached, just send the stream list. */
                send_streams = 1;
                response.status = htobe32(VIEWER_ATTACH_OK);
@@ -705,6 +705,7 @@ int viewer_attach_session(struct relay_command *cmd,
                session->viewer_attached++;
                send_streams = 1;
                response.status = htobe32(VIEWER_ATTACH_OK);
+               cmd->session_id = session->id;
                cmd->session = session;
        }
 
@@ -1433,15 +1434,13 @@ void deferred_free_viewer_stream(struct rcu_head *head)
 }
 
 static
-void viewer_del_streams(struct relay_session *session)
+void viewer_del_streams(uint64_t session_id)
 {
        int ret;
        struct relay_viewer_stream *stream;
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
 
-       assert(session);
-
        rcu_read_lock();
        cds_lfht_for_each_entry(viewer_streams_ht->ht, &iter.iter, node, node) {
                node = lttng_ht_iter_get_node_u64(&iter);
@@ -1450,7 +1449,7 @@ void viewer_del_streams(struct relay_session *session)
                }
 
                stream = caa_container_of(node, struct relay_viewer_stream, stream_n);
-               if (stream->session_id != session->id) {
+               if (stream->session_id != session_id) {
                        continue;
                }
 
@@ -1494,9 +1493,7 @@ void del_connection(struct lttng_ht *relay_connections_ht,
        ret = lttng_ht_del(relay_connections_ht, iter);
        assert(!ret);
 
-       if (relay_connection->session) {
-               viewer_del_streams(relay_connection->session);
-       }
+       viewer_del_streams(relay_connection->session_id);
 
        call_rcu(&relay_connection->rcu_node, deferred_free_connection);
 }
index 3c8c26c29ec0e6fe4d54b2ee42303895913fff21..358615f9ad27476ea8ee0f4bba7cc431c379a293 100644 (file)
@@ -166,6 +166,7 @@ struct relay_command {
        uint32_t major;
        uint32_t minor;
        struct lttng_ht *ctf_traces_ht; /* indexed by path name */
+       uint64_t session_id;
 };
 
 struct relay_local_data {
This page took 0.028211 seconds and 4 git commands to generate.