From b5f5f9e1854297ddff94aa9e210dbf865e0edcfa Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Wed, 27 Nov 2013 11:40:12 -0500 Subject: [PATCH] Handle empty streams on iterator init In live trace streaming, we can create an iterator with inactive streams. This patch allows inactive streams to be considered as valid. Signed-off-by: Julien Desfossez Signed-off-by: Mathieu Desnoyers --- lib/iterator.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/iterator.c b/lib/iterator.c index 155fcbe6f..3280f4a81 100644 --- a/lib/iterator.c +++ b/lib/iterator.c @@ -725,7 +725,7 @@ int bt_iter_init(struct bt_iter *iter, if (ret == EOF) { ret = 0; continue; - } else if (ret) { + } else if (ret != 0 && ret != EAGAIN) { goto error; } /* Add to heap */ @@ -821,6 +821,13 @@ reinsert: removed = bt_heap_replace_max(iter->stream_heap, file_stream); assert(removed == file_stream); + file_stream = bt_heap_maximum(iter->stream_heap); + if (file_stream->pos.content_size == 0) { + ret = EAGAIN; + } else { + ret = 0; + } + end: return ret; } -- 2.34.1