#include <common/sessiond-comm/relayd.h>
#include <common/uri.h>
#include <common/utils.h>
+#include <common/path.h>
#include <common/align.h>
#include <common/config/session-config.h>
#include <common/dynamic-buffer.h>
* request.
*/
try_stream_close(stream);
- if (stream->is_metadata) {
- struct relay_viewer_stream *vstream;
-
- vstream = viewer_stream_get_by_id(stream->stream_handle);
- if (vstream) {
- if (stream->no_new_metadata_notified) {
- /*
- * Since all the metadata has been sent to the
- * viewer and that we have a request to close
- * its stream, we can safely teardown the
- * corresponding metadata viewer stream.
- */
- viewer_stream_put(vstream);
- }
- /* Put local reference. */
- viewer_stream_put(vstream);
- }
- }
stream_put(stream);
ret = 0;
*/
next_trace_chunk = sessiond_trace_chunk_registry_get_chunk(
sessiond_trace_chunk_registry,
- session->sessiond_uuid, session->id,
+ session->sessiond_uuid,
+ conn->session->id_sessiond.is_set ?
+ conn->session->id_sessiond.value :
+ conn->session->id,
rotate_streams.new_chunk_id.value);
if (!next_trace_chunk) {
char uuid_str[LTTNG_UUID_STR_LEN];
msg->creation_timestamp = be64toh(msg->creation_timestamp);
msg->override_name_length = be32toh(msg->override_name_length);
+ pthread_mutex_lock(&conn->session->lock);
+ session->ongoing_rotation = true;
if (session->current_trace_chunk &&
!lttng_trace_chunk_get_name_overridden(session->current_trace_chunk)) {
chunk_status = lttng_trace_chunk_rename_path(session->current_trace_chunk,
goto end;
}
}
- session->ongoing_rotation = true;
if (!session->current_trace_chunk) {
if (!session->has_rotated) {
new_path = "";
published_chunk = sessiond_trace_chunk_registry_publish_chunk(
sessiond_trace_chunk_registry,
conn->session->sessiond_uuid,
- conn->session->id,
+ conn->session->id_sessiond.is_set ?
+ conn->session->id_sessiond.value :
+ conn->session->id,
chunk);
if (!published_chunk) {
char uuid_str[LTTNG_UUID_STR_LEN];
goto end;
}
- pthread_mutex_lock(&conn->session->lock);
if (conn->session->pending_closure_trace_chunk) {
/*
* Invalid; this means a second create_trace_chunk command was
ERR("Invalid trace chunk close command received; a trace chunk is already waiting for a trace chunk close command");
reply_code = LTTNG_ERR_INVALID_PROTOCOL;
ret = -1;
- goto end_unlock_session;
+ goto end;
}
conn->session->pending_closure_trace_chunk =
conn->session->current_trace_chunk;
if (!conn->session->pending_closure_trace_chunk) {
session->ongoing_rotation = false;
}
-end_unlock_session:
- pthread_mutex_unlock(&conn->session->lock);
end:
+ pthread_mutex_unlock(&conn->session->lock);
reply.ret_code = htobe32((uint32_t) reply_code);
send_ret = conn->sock->ops->sendmsg(conn->sock,
&reply,
chunk = sessiond_trace_chunk_registry_get_chunk(
sessiond_trace_chunk_registry,
conn->session->sessiond_uuid,
- conn->session->id,
+ conn->session->id_sessiond.is_set ?
+ conn->session->id_sessiond.value :
+ conn->session->id,
chunk_id);
if (!chunk) {
char uuid_str[LTTNG_UUID_STR_LEN];