}
data_size = be64toh(recv_hdr->data_size);
- payload_size = data_size - sizeof(uint64_t);
+ payload_size = data_size;
+ /*
+ * Add 8 bytes (uint64_t) to the data size which is the value of the
+ * stream_id and the payload size.
+ */
+ data_size += sizeof(uint64_t);
if (data_buffer_size < data_size) {
data_buffer = realloc(data_buffer, data_size);
if (!data_buffer) {
}
memset(data_buffer, 0, data_size);
DBG2("Relay receiving metadata, waiting for %lu bytes", data_size);
- ret = cmd->sock->ops->recvmsg(cmd->sock, data_buffer, data_size, MSG_WAITALL);
+ ret = cmd->sock->ops->recvmsg(cmd->sock, data_buffer, data_size,
+ MSG_WAITALL);
if (ret < 0 || ret != data_size) {
ret = -1;
ERR("Relay didn't receive the whole metadata");
ret = write(metadata_stream->fd, metadata_struct->payload,
payload_size);
} while (ret < 0 && errno == EINTR);
- if (ret < (payload_size)) {
+ if (ret < payload_size) {
ERR("Relay error writing metadata on file");
ret = -1;
goto end_unlock;
}
memset(data_buffer, 0, data_size);
+ DBG3("Receiving data of size %u for stream id %zu", data_size, stream_id);
ret = cmd->sock->ops->recvmsg(cmd->sock, data_buffer, data_size, MSG_WAITALL);
if (ret <= 0) {
ret = -1;
/* Infinite blocking call, waiting for transmission */
restart:
+ DBG3("Relayd worker thread polling...");
ret = lttng_poll_wait(&events, -1);
if (ret < 0) {
/*