Fix: don't ask data pending if session was not started
authorDavid Goulet <dgoulet@efficios.com>
Tue, 25 Mar 2014 15:34:47 +0000 (11:34 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 25 Mar 2014 15:36:25 +0000 (11:36 -0400)
Fixes #770

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/cmd.c

index 20b0720604e4f2379ab7053e1ac769dda1976405..36fe233ae8fc8681c0a90ef8b854d76af01c888e 100644 (file)
@@ -2528,6 +2528,21 @@ int cmd_data_pending(struct ltt_session *session)
        if (session->enabled) {
                ret = LTTNG_ERR_SESSION_STARTED;
                goto error;
+       } else {
+               /*
+                * If stopped, just make sure we've started before else the above call
+                * will always send that there is data pending.
+                *
+                * The consumer assumes that when the data pending command is received,
+                * the trace has been started before or else no output data is written
+                * by the streams which is a condition for data pending. So, this is
+                * *VERY* important that we don't ask the consumer before a start
+                * trace.
+                */
+               if (!session->started) {
+                       ret = 0;
+                       goto error;
+               }
        }
 
        if (ksess && ksess->consumer) {
This page took 0.029166 seconds and 4 git commands to generate.