vstream = viewer_stream_get_by_id(stream->stream_handle);
if (vstream) {
- if (vstream->metadata_sent == stream->metadata_received) {
+ if (stream->no_new_metadata_notified) {
/*
* Since all the metadata has been sent to the
* viewer and that we have a request to close
index_info.stream_instance_id =
be64toh(index_info.stream_instance_id);
index_info.packet_seq_num = be64toh(index_info.packet_seq_num);
+ } else {
+ index_info.stream_instance_id = -1ULL;
+ index_info.packet_seq_num = -1ULL;
}
stream = stream_get_by_id(index_info.relay_stream_id);
struct lttng_trace_chunk *chunk = NULL, *published_chunk = NULL;
enum lttng_error_code reply_code = LTTNG_OK;
enum lttng_trace_chunk_status chunk_status;
- struct lttng_directory_handle session_output;
+ struct lttng_directory_handle *session_output = NULL;
if (!session || !conn->version_check_done) {
ERR("Trying to create a trace chunk before version check");
goto end;
}
- ret = session_init_output_directory_handle(
- conn->session, &session_output);
- if (ret) {
+ session_output = session_create_output_directory_handle(
+ conn->session);
+ if (!session_output) {
reply_code = LTTNG_ERR_CREATE_DIR_FAIL;
goto end;
}
- chunk_status = lttng_trace_chunk_set_as_owner(chunk, &session_output);
- lttng_directory_handle_fini(&session_output);
+ chunk_status = lttng_trace_chunk_set_as_owner(chunk, session_output);
+ lttng_directory_handle_put(session_output);
+ session_output = NULL;
if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
reply_code = LTTNG_ERR_UNK;
ret = -1;
end_no_reply:
lttng_trace_chunk_put(chunk);
lttng_trace_chunk_put(published_chunk);
+ lttng_directory_handle_put(session_output);
return ret;
}