channel->session_id,
cpu,
&alloc_ret,
- channel->type);
+ channel->type,
+ channel->monitor);
if (stream == NULL) {
switch (alloc_ret) {
case -ENOENT:
/* Remove node from the channel stream list. */
cds_list_del(&stream->send_node);
+
+ /*
+ * From this point on, the stream's ownership has been moved away from
+ * the channel and becomes globally visible.
+ */
+ stream->globally_visible = 1;
}
error:
if (cds_list_empty(&metadata->streams.head)) {
ERR("Metadata channel key %" PRIu64 ", no stream available.", key);
ret = LTTCOMM_CONSUMERD_ERROR_METADATA;
- goto error;
+ goto error_no_stream;
}
/* Send metadata stream to relayd if needed. */
* the stream is still in the local stream list of the channel. This call
* will make sure to clean that list.
*/
- consumer_del_channel(metadata);
+ cds_list_del(&metadata->metadata_stream->send_node);
+ consumer_stream_destroy(metadata->metadata_stream, NULL);
+error_no_stream:
end:
return ret;
}
if (ret != sizeof(msg)) {
DBG("Consumer received unexpected message size %zd (expects %zu)",
ret, sizeof(msg));
- lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_ERROR_RECV_CMD);
/*
* The ret value might 0 meaning an orderly shutdown but this is ok
* since the caller handles this.
*/
if (ret > 0) {
+ lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_ERROR_RECV_CMD);
ret = -1;
}
return ret;