pthread_mutex_unlock(&session->viewer_ready_lock);
ret = stream_close(session, stream);
- if (!ret) {
+ if (ret || session->snapshot) {
/* Already close thus the ctf trace is being or has been destroyed. */
goto end;
}
stream->stream_handle);
end:
+ memset(&reply, 0, sizeof(reply));
reply.handle = htobe64(stream->stream_handle);
/* send the session id to the client or a negative return code on error */
if (ret < 0) {
end_unlock:
rcu_read_unlock();
+ memset(&reply, 0, sizeof(reply));
if (ret < 0) {
reply.ret_code = htobe32(LTTNG_ERR_UNK);
} else {
struct lttcomm_relayd_generic_reply reply;
int ret;
+ memset(&reply, 0, sizeof(reply));
reply.ret_code = htobe32(LTTNG_ERR_UNK);
ret = conn->sock->ops->sendmsg(conn->sock, &reply,
sizeof(struct lttcomm_relayd_generic_reply), 0);
ret = htobe32(LTTNG_ERR_UNK);
}
+ memset(&reply, 0, sizeof(reply));
reply.ret_code = ret;
ret = conn->sock->ops->sendmsg(conn->sock, &reply,
sizeof(struct lttcomm_relayd_generic_reply), 0);
goto end;
}
+ memset(&reply, 0, sizeof(reply));
reply.major = RELAYD_VERSION_COMM_MAJOR;
reply.minor = RELAYD_VERSION_COMM_MINOR;
end_unlock:
rcu_read_unlock();
+ memset(&reply, 0, sizeof(reply));
reply.ret_code = htobe32(ret);
ret = conn->sock->ops->sendmsg(conn->sock, &reply, sizeof(reply), 0);
if (ret < 0) {
}
rcu_read_unlock();
+ memset(&reply, 0, sizeof(reply));
reply.ret_code = htobe32(LTTNG_OK);
ret = conn->sock->ops->sendmsg(conn->sock, &reply, sizeof(reply), 0);
if (ret < 0) {
}
rcu_read_unlock();
+ memset(&reply, 0, sizeof(reply));
/* All good, send back reply. */
reply.ret_code = htobe32(LTTNG_OK);
cds_lfht_for_each_entry(relay_streams_ht->ht, &iter.iter, stream,
node.node) {
if (stream->session_id == session_id &&
- !stream->data_pending_check_done) {
+ !stream->data_pending_check_done && !stream->terminated_flag) {
is_data_inflight = 1;
DBG("Data is still in flight for stream %" PRIu64,
stream->stream_handle);
}
rcu_read_unlock();
+ memset(&reply, 0, sizeof(reply));
/* All good, send back reply. */
reply.ret_code = htobe32(is_data_inflight);
/* Do we have a writable ready index to write on disk. */
if (wr_index) {
- /* Starting at 2.4, create the index file if none available. */
- if (conn->minor >= 4 && stream->index_fd < 0) {
- ret = index_create_file(stream->path_name, stream->channel_name,
- relayd_uid, relayd_gid, stream->tracefile_size,
- stream->tracefile_count_current);
- if (ret < 0) {
- goto end_rcu_unlock;
- }
- stream->index_fd = ret;
- }
-
ret = relay_index_write(wr_index->fd, wr_index);
if (ret < 0) {
goto end_rcu_unlock;
end_rcu_unlock:
rcu_read_unlock();
+ memset(&reply, 0, sizeof(reply));
if (ret < 0) {
reply.ret_code = htobe32(LTTNG_ERR_UNK);
} else {
/*
* Inform the viewer that there are new streams in the session.
*/
- uatomic_set(&conn->session->new_streams, 1);
+ if (conn->session->viewer_refcount) {
+ uatomic_set(&conn->session->new_streams, 1);
+ }
+ memset(&reply, 0, sizeof(reply));
reply.ret_code = htobe32(LTTNG_OK);
send_ret = conn->sock->ops->sendmsg(conn->sock, &reply, sizeof(reply), 0);
if (send_ret < 0) {