When content_size == 0, just set the timestamp_end of the packet and
reinsert the stream in the heap.
This is required to handle the beacons of inactivity generated in
LTTng live trace streaming.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
*/
if (unlikely(pos->offset == EOF))
return EOF;
*/
if (unlikely(pos->offset == EOF))
return EOF;
+
+ if (pos->content_size == 0) {
+ /* Stream is inactive for now (live reading). */
+ return EAGAIN;
+ }
assert(pos->offset < pos->content_size);
/* Read event header */
assert(pos->offset < pos->content_size);
/* Read event header */
ret = sin->pos.parent.event_cb(&sin->pos.parent, &sin->parent);
if (ret == EOF)
return EOF;
ret = sin->pos.parent.event_cb(&sin->pos.parent, &sin->parent);
if (ret == EOF)
return EOF;
+ else if (ret == EAGAIN)
+ /* Stream is inactive for now (live reading). */
+ return EAGAIN;
else if (ret) {
fprintf(stderr, "[error] Reading event failed.\n");
return ret;
else if (ret) {
fprintf(stderr, "[error] Reading event failed.\n");
return ret;
assert(removed == file_stream);
ret = 0;
goto end;
assert(removed == file_stream);
ret = 0;
goto end;
+ } else if (ret == EAGAIN) {
+ /*
+ * The stream is inactive for now, we just updated the timestamp_end
+ * to skip over this stream up to a certain point in time.
+ */
+ goto reinsert;
} else if (ret) {
goto end;
}
} else if (ret) {
goto end;
}
/* Reinsert the file stream into the heap, and rebalance. */
removed = bt_heap_replace_max(iter->stream_heap, file_stream);
assert(removed == file_stream);
/* Reinsert the file stream into the heap, and rebalance. */
removed = bt_heap_replace_max(iter->stream_heap, file_stream);
assert(removed == file_stream);