X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fconsumer.c;h=61d6f2e79b702337e3e8095da5132136714616b5;hp=be984a49270fefbba0b55bccd8ebf897ceea4ce7;hb=39df6d9f42d8644d9ee25c8c02517b2cef6f5941;hpb=f9dfc3d95caf3a7d927d58f252006390e168a1c2 diff --git a/src/common/consumer.c b/src/common/consumer.c index be984a492..61d6f2e79 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -782,6 +782,13 @@ static int write_relayd_stream_header(struct lttng_consumer_stream *stream, data_hdr.stream_id = htobe64(stream->relayd_stream_id); data_hdr.data_size = htobe32(data_size); data_hdr.padding_size = htobe32(padding); + /* + * Note that net_seq_num below is assigned with the *current* value of + * next_net_seq_num and only after that the next_net_seq_num will be + * increment. This is why when issuing a command on the relayd using + * this next value, 1 should always be substracted in order to compare + * the last seen sequence number on the relayd side to the last sent. + */ data_hdr.net_seq_num = htobe64(stream->next_net_seq_num++); /* Other fields are zeroed previously */ @@ -3021,7 +3028,8 @@ int consumer_data_pending(uint64_t id) stream->relayd_stream_id); } else { ret = relayd_data_pending(&relayd->control_sock, - stream->relayd_stream_id, stream->next_net_seq_num); + stream->relayd_stream_id, + stream->next_net_seq_num - 1); } pthread_mutex_unlock(&relayd->ctrl_sock_mutex); if (ret == 1) {