X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fconsumer-stream.c;h=723ec829f80095ff17bd3e5996540d01d754072a;hp=03bac86870031eb2b63661f178f5cee0601748c6;hb=d01178b6f6465443d7e6e1015aa7054e9d093e91;hpb=c6857fcff91346ea41a5e9ea9a1ab0fcdb19944c diff --git a/src/common/consumer-stream.c b/src/common/consumer-stream.c index 03bac8687..723ec829f 100644 --- a/src/common/consumer-stream.c +++ b/src/common/consumer-stream.c @@ -58,8 +58,10 @@ void consumer_stream_relayd_close(struct lttng_consumer_stream *stream, assert(stream); assert(relayd); - uatomic_dec(&relayd->refcount); - assert(uatomic_read(&relayd->refcount) >= 0); + if (stream->sent_to_relayd) { + uatomic_dec(&relayd->refcount); + assert(uatomic_read(&relayd->refcount) >= 0); + } /* Closing streams requires to lock the control socket. */ pthread_mutex_lock(&relayd->ctrl_sock_mutex); @@ -82,6 +84,7 @@ void consumer_stream_relayd_close(struct lttng_consumer_stream *stream, consumer_destroy_relayd(relayd); } stream->net_seq_idx = (uint64_t) -1ULL; + stream->sent_to_relayd = 0; } /*