X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Flttng-live%2Flttng-live-comm.c;fp=formats%2Flttng-live%2Flttng-live-comm.c;h=0a895b38622b9ddb6cd7554cdaa0c6e30ac30dad;hp=cd146d764886d21032dbe4e0dfe8e0e01fc7c385;hb=76206d8105706488f2bc84ce64f5a126d87c8219;hpb=56f9171103e1b2ab24249f69ed52c57c6cffb0f4 diff --git a/formats/lttng-live/lttng-live-comm.c b/formats/lttng-live/lttng-live-comm.c index cd146d76..0a895b38 100644 --- a/formats/lttng-live/lttng-live-comm.c +++ b/formats/lttng-live/lttng-live-comm.c @@ -650,17 +650,6 @@ retry: goto end; } - /* - * Flush the output between attempts to grab a packet, thus - * ensuring we flush at least at the periodical timer period. - * This ensures the output remains reactive for interactive users and - * that the output is flushed when redirected to a file by the shell. - */ - if (fflush(LTTNG_LIVE_OUTPUT_FP) < 0) { - perror("fflush"); - goto error; - } - cmd.cmd = htobe32(LTTNG_VIEWER_GET_PACKET); cmd.data_size = htobe64((uint64_t) sizeof(rq)); cmd.cmd_version = htobe32(0); @@ -1293,6 +1282,17 @@ retry: cur_index->ts_real.timestamp_begin; } + /* + * Flush the output between attempts to grab a packet, thus + * ensuring we flush at least at the periodical timer period. + * This ensures the output remains reactive for interactive users and + * that the output is flushed when redirected to a file by the shell. + */ + if (fflush(LTTNG_LIVE_OUTPUT_FP) < 0) { + perror("fflush"); + goto end; + } + if (pos->packet_size == 0 || pos->offset == EOF) { goto end; }