sessiond: notification: use lttng_payload for communications
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-internal.h
index 5aaac9d23fb6821e9a24634741b7d9760f04b665..eb23d1f78fa2df8d106cdb9fe4caddf1177bb90d 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <common/compat/socket.h>
 #include <common/credentials.h>
+#include <common/payload.h>
 #include <lttng/notification/channel-internal.h>
 #include <lttng/ref-internal.h>
 #include <stdbool.h>
@@ -111,7 +112,16 @@ struct notification_client_list {
 };
 
 struct notification_client {
-       /* Nests within the notification_client_list lock. */
+       /*
+        * Nests within the notification_client_list lock.
+        *
+        * Protects the outbound communication and the active flag which
+        * is used by both the notification and action executor threads.
+        *
+        * The remaining fields of the object can be used without any
+        * synchronization as they are either immutable (id, creds, version) or
+        * only accessed by the notification thread.
+        */
        pthread_mutex_t lock;
        notification_client_id id;
        int socket;
@@ -147,9 +157,11 @@ struct notification_client {
                         * buffers' "size" is set to contain the current
                         * message's complete payload.
                         */
-                       struct lttng_dynamic_buffer buffer;
+                       struct lttng_payload payload;
                        /* Bytes left to receive for the current message. */
                        size_t bytes_to_receive;
+                       /* FDs left to receive for the current message. */
+                       int fds_to_receive;
                        /* Type of the message being received. */
                        enum lttng_notification_channel_message_type msg_type;
                        /*
@@ -183,7 +195,7 @@ struct notification_client {
                         * misbehaving/malicious client.
                         */
                        bool queued_command_reply;
-                       struct lttng_dynamic_buffer buffer;
+                       struct lttng_payload payload;
                } outbound;
        } communication;
        /* call_rcu delayed reclaim. */
@@ -205,6 +217,7 @@ bool notification_client_list_get(struct notification_client_list *list);
 LTTNG_HIDDEN
 void notification_client_list_put(struct notification_client_list *list);
 
+/* Only returns a non-zero value if a fatal error occurred. */
 typedef int (*report_client_transmission_result_cb)(
                struct notification_client *client,
                enum client_transmission_status status,
This page took 0.023847 seconds and 4 git commands to generate.