ctf: refactor metadata decoder to always have an instance
[babeltrace.git] / src / plugins / ctf / lttng-live / data-stream.c
index c89cba5210d0ec0dc89c0f135f4e12900e782f72..04496b81530ffcec61c86e773933ad78d6d5b13c 100644 (file)
@@ -26,7 +26,7 @@
 #define BT_COMP_LOG_SELF_COMP self_comp
 #define BT_LOG_OUTPUT_LEVEL log_level
 #define BT_LOG_TAG "PLUGIN/SRC.CTF.LTTNG-LIVE/DS"
-#include "plugins/comp-logging.h"
+#include "logging/comp-logging.h"
 
 #include <stdio.h>
 #include <stdint.h>
@@ -58,12 +58,18 @@ enum bt_msg_iter_medium_status medop_request_bytes(
        uint64_t len_left;
        uint64_t read_len;
 
+       if (stream->has_stream_hung_up) {
+               status = BT_MSG_ITER_MEDIUM_STATUS_EOF;
+               goto end;
+       }
+
        len_left = stream->base_offset + stream->len - stream->offset;
        if (!len_left) {
                stream->state = LTTNG_LIVE_STREAM_ACTIVE_NO_DATA;
                status = BT_MSG_ITER_MEDIUM_STATUS_AGAIN;
-               return status;
+               goto end;
        }
+
        read_len = MIN(request_sz, stream->buflen);
        read_len = MIN(read_len, len_left);
        status = lttng_live_get_stream_bytes(live_msg_iter,
@@ -72,6 +78,7 @@ enum bt_msg_iter_medium_status medop_request_bytes(
        *buffer_addr = stream->buf;
        *buffer_sz = recv_len;
        stream->offset += recv_len;
+end:
        return status;
 }
 
This page took 0.028154 seconds and 4 git commands to generate.