X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fnotification-thread-events.c;h=e915b33b55631e4035052d4e66a46056dca464c7;hp=fe2d0826b8954db180a005b2edcb4e7c8251055b;hb=5f2c1c0ff0173e7ce9a6528d6129563d24687325;hpb=3b68d0a3fdf213b4078b80380186aa78670d2712 diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c index fe2d0826b..e915b33b5 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -403,7 +403,7 @@ void session_info_destroy(void *_data) if (session_info->channel_infos_ht) { ret = cds_lfht_destroy(session_info->channel_infos_ht, NULL); if (ret) { - ERR("Channel information hash table destroy"); + ERR("[notification-thread] Failed to destroy channel information hash table"); } } free(session_info->name); @@ -715,6 +715,7 @@ int notification_thread_client_subscribe(struct notification_client *client, client, state)) { WARN("[notification-thread] Evaluation of a condition on client subscription failed, aborting."); ret = -1; + free(client_list_element); goto end_unlock; } @@ -2343,7 +2344,6 @@ int evaluate_condition(const struct lttng_condition *condition, break; case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE: *evaluation = lttng_evaluation_session_consumed_size_create( - condition_type, latest_session_consumed_total); break; default: @@ -2386,8 +2386,9 @@ int send_evaluation_to_clients(struct lttng_trigger *trigger, struct notification_client_list_element *client_list_element, *tmp; struct lttng_notification *notification; struct lttng_condition *condition; - ssize_t expected_notification_size, notification_size; - struct lttng_notification_channel_message msg; + struct lttng_notification_channel_message msg_header = { + .type = (int8_t) LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION, + }; lttng_dynamic_buffer_init(&msg_buffer); @@ -2400,35 +2401,23 @@ int send_evaluation_to_clients(struct lttng_trigger *trigger, goto end; } - expected_notification_size = lttng_notification_serialize(notification, - NULL); - if (expected_notification_size < 0) { - ERR("[notification-thread] Failed to get size of serialized notification"); - ret = -1; - goto end; - } - - msg.type = (int8_t) LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION; - msg.size = (uint32_t) expected_notification_size; - ret = lttng_dynamic_buffer_append(&msg_buffer, &msg, sizeof(msg)); + ret = lttng_dynamic_buffer_append(&msg_buffer, &msg_header, + sizeof(msg_header)); if (ret) { goto end; } - ret = lttng_dynamic_buffer_set_size(&msg_buffer, - msg_buffer.size + expected_notification_size); + ret = lttng_notification_serialize(notification, &msg_buffer); if (ret) { - goto end; - } - - notification_size = lttng_notification_serialize(notification, - msg_buffer.data + sizeof(msg)); - if (notification_size != expected_notification_size) { ERR("[notification-thread] Failed to serialize notification"); ret = -1; goto end; } + /* Update payload size. */ + ((struct lttng_notification_channel_message * ) msg_buffer.data)->size = + (uint32_t) (msg_buffer.size - sizeof(msg_header)); + cds_list_for_each_entry_safe(client_list_element, tmp, &client_list->list, node) { struct notification_client *client =