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.6.1~37 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=387137a7410f05eae122b7a44ee5893d66b1b113;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 1ae1ae98b..7b1602d36 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -1272,8 +1272,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. */ @@ -1396,7 +1396,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);