From: Mathieu Desnoyers Date: Tue, 25 Aug 2015 12:16:37 +0000 (-0400) Subject: Fix: handle 0 session case in ask new streams X-Git-Tag: v1.4.4~9 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=4e58c7d3a75d70c46186e33680cc16533430c6a9 Fix: handle 0 session case in ask new streams If all sessions are closed by the time we ask for new streams, we could end up looping forever waiting for new streams, so we now check we are still waiting for something before looping. Signed-off-by: Mathieu Desnoyers Signed-off-by: Julien Desfossez Signed-off-by: Jérémie Galarneau --- diff --git a/formats/lttng-live/lttng-live-comm.c b/formats/lttng-live/lttng-live-comm.c index 64fc81f6..bcbb06aa 100644 --- a/formats/lttng-live/lttng-live-comm.c +++ b/formats/lttng-live/lttng-live-comm.c @@ -594,7 +594,12 @@ restart: nb_streams += ret; } } - ret = nb_streams; + if (ctx->session_ids->len == 0) { + /* All sessions are closed. */ + ret = -1; + } else { + ret = nb_streams; + } end: return ret;