Fixes #770
Signed-off-by: David Goulet <dgoulet@efficios.com>
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) {