From: Mathieu Desnoyers Date: Tue, 25 Aug 2015 11:47:08 +0000 (-0400) Subject: Fix: relayd reply error to client if cannot find viewer stream X-Git-Tag: v2.7.0-rc2~92 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=72dffa35ae4acc1aa99419ae9c09d65eda5c1297;p=lttng-tools.git Fix: relayd reply error to client if cannot find viewer stream Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c index 5d3449d4f..c5a6e4edd 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -1273,8 +1273,8 @@ int viewer_get_next_index(struct relay_connection *conn) vstream = viewer_stream_get_by_id(be64toh(request_index.stream_id)); if (!vstream) { - ret = -1; - goto end; + viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_ERR); + goto send_reply; } /* Use back. ref. Protected by refcounts. */ @@ -1397,7 +1397,9 @@ int viewer_get_next_index(struct relay_connection *conn) viewer_index.stream_id = packet_index.stream_id; send_reply: - pthread_mutex_unlock(&rstream->lock); + if (rstream) { + pthread_mutex_unlock(&rstream->lock); + } if (metadata_viewer_stream) { pthread_mutex_lock(&metadata_viewer_stream->stream->lock);