Move to kernel style SPDX license identifiers
[babeltrace.git] / src / plugins / ctf / lttng-live / lttng-live.c
index 6d77035b3ecde36fedcfac32db8fb097bef84980..20113e6c401fe1b7cda5af374db84e11d3770009 100644 (file)
@@ -1,31 +1,11 @@
 /*
- * lttng-live.c
- *
- * Babeltrace CTF LTTng-live Client Component
+ * SPDX-License-Identifier: MIT
  *
  * Copyright 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
  * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  * Copyright 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
- * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Babeltrace CTF LTTng-live Client Component
  */
 
 #define BT_COMP_LOG_SELF_COMP self_comp
@@ -740,7 +720,7 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter,
                        msg);
                break;
        case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
-               clock_snapshot = bt_message_message_iterator_inactivity_borrow_default_clock_snapshot_const(
+               clock_snapshot = bt_message_message_iterator_inactivity_borrow_clock_snapshot_const(
                        msg);
                break;
        default:
@@ -873,6 +853,10 @@ enum lttng_live_iterator_status lttng_live_iterator_close_stream(
                        "Error getting the next message from CTF message iterator");
                live_status = LTTNG_LIVE_ITERATOR_STATUS_ERROR;
                goto end;
+       } else if (status == CTF_MSG_ITER_STATUS_EOF) {
+               BT_COMP_LOGI("Reached the end of the live stream iterator.");
+               live_status = LTTNG_LIVE_ITERATOR_STATUS_END;
+               goto end;
        }
 
        BT_ASSERT(status == CTF_MSG_ITER_STATUS_OK);
@@ -1061,7 +1045,7 @@ enum lttng_live_iterator_status next_stream_iterator_for_trace(
 
                        /*
                         * Check if the message of the current live stream
-                        * iterator occured at the exact same time or after the
+                        * iterator occurred at the exact same time or after the
                         * last message returned by this component's message
                         * iterator. If not, we return an error.
                         */
@@ -1567,7 +1551,6 @@ BT_HIDDEN
 bt_message_iterator_class_initialize_method_status lttng_live_msg_iter_init(
                bt_self_message_iterator *self_msg_it,
                bt_self_message_iterator_configuration *config,
-               bt_self_component *self_comp,
                bt_self_component_port_output *self_port)
 {
        bt_message_iterator_class_initialize_method_status status;
@@ -1575,8 +1558,8 @@ bt_message_iterator_class_initialize_method_status lttng_live_msg_iter_init(
        struct lttng_live_msg_iter *lttng_live_msg_iter;
        enum lttng_live_viewer_status viewer_status;
        bt_logging_level log_level;
-
-       BT_ASSERT(self_msg_it);
+       bt_self_component *self_comp =
+               bt_self_message_iterator_borrow_component(self_msg_it);
 
        lttng_live = bt_self_component_get_data(self_comp);
        log_level = lttng_live->log_level;
This page took 0.025278 seconds and 4 git commands to generate.