Cleanup: remove duplicated code in snapshot record command
[lttng-tools.git] / src / common / consumer / consumer.c
index 9d25d83a341e2c853026f2fb6a4b4a25b10bd2dc..3c20c57bda9d68ac1967de0cf433901ab8cce7e6 100644 (file)
@@ -1245,6 +1245,8 @@ void lttng_consumer_cleanup(void)
         * it.
         */
        lttng_ht_destroy(consumer_data.stream_list_ht);
+
+       lttng_trace_chunk_registry_destroy(consumer_data.chunk_registry);
 }
 
 /*
@@ -3463,6 +3465,11 @@ int lttng_consumer_init(void)
                goto error;
        }
 
+       consumer_data.chunk_registry = lttng_trace_chunk_registry_create();
+       if (!consumer_data.chunk_registry) {
+               goto error;
+       }
+
        return 0;
 
 error:
@@ -4478,3 +4485,24 @@ int lttng_consumer_mkdir(const char *path, uid_t uid, gid_t gid,
                return mkdir_local(path, uid, gid);
        }
 }
+
+enum lttcomm_return_code lttng_consumer_init_command(
+               struct lttng_consumer_local_data *ctx,
+               const lttng_uuid sessiond_uuid)
+{
+       enum lttcomm_return_code ret;
+       char uuid_str[UUID_STR_LEN];
+
+       if (ctx->sessiond_uuid.is_set) {
+               ret = LTTCOMM_CONSUMERD_ALREADY_SET;
+               goto end;
+       }
+
+       ctx->sessiond_uuid.is_set = true;
+       memcpy(ctx->sessiond_uuid.value, sessiond_uuid, sizeof(lttng_uuid));
+       ret = LTTCOMM_CONSUMERD_SUCCESS;
+       lttng_uuid_to_str(sessiond_uuid, uuid_str);
+       DBG("Received session daemon UUID: %s", uuid_str);
+end:
+       return ret;
+}
This page took 0.023695 seconds and 4 git commands to generate.