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.5.4~10 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=2600cf835eaf1fa6b468f80eb283e3d7df03f743 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;