Fix: notify the viewer if new streams got added
[lttng-tools.git] / src / bin / lttng-relayd / lttng-relayd.h
index bb5b7a365aaae214a10bd3757e34f1074ce4e81f..ab1ccd410e06773686f2bf6f3aefcc9c15ccb362 100644 (file)
@@ -23,6 +23,7 @@
 #include <limits.h>
 #include <urcu.h>
 #include <urcu/wfqueue.h>
+#include <urcu/list.h>
 
 #include <common/hashtable/hashtable.h>
 #include <common/index/ctf-index.h>
@@ -44,6 +45,16 @@ enum connection_type {
        RELAY_VIEWER_NOTIFICATION   = 4,
 };
 
+/*
+ * When we receive a stream, it gets stored in a list (on a per connection
+ * basis) until we have all the streams of the same channel and the metadata
+ * associated with it, then it gets flagged with viewer_ready.
+ */
+struct relay_stream_recv_handle {
+       uint64_t id;    /* stream handle */
+       struct cds_list_head node;
+};
+
 /*
  * Represents a session for the relay point of view
  */
@@ -72,6 +83,11 @@ struct relay_session {
         */
        uint64_t minor;
        uint64_t major;
+       /*
+        * Flag checked and exchanged with uatomic_cmpxchg to tell the
+        * viewer-side if new streams got added since the last check.
+        */
+       unsigned long new_streams;
 };
 
 /*
@@ -144,6 +160,11 @@ struct relay_stream {
         * update the oldest_tracefile_id.
         */
        unsigned int tracefile_overwrite:1;
+       /*
+        * Can this stream be used by a viewer or are we waiting for additional
+        * information.
+        */
+       unsigned int viewer_ready:1;
 };
 
 /*
@@ -200,12 +221,13 @@ struct relay_command {
        struct lttng_ht_node_ulong sock_n;
        struct rcu_head rcu_node;
        enum connection_type type;
-       unsigned int version_check_done:1;
        /* protocol version to use for this session */
        uint32_t major;
        uint32_t minor;
        struct lttng_ht *ctf_traces_ht; /* indexed by path name */
        uint64_t session_id;
+       struct cds_list_head recv_head;
+       unsigned int version_check_done:1;
 };
 
 struct relay_local_data {
@@ -222,6 +244,9 @@ extern const char *tracing_group_name;
 
 extern const char * const config_section_name;
 
+extern int thread_quit_pipe[2];
+
 struct relay_stream *relay_stream_find_by_id(uint64_t stream_id);
+void lttng_relay_notify_ready(void);
 
 #endif /* LTTNG_RELAYD_H */
This page took 0.023436 seconds and 4 git commands to generate.