* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define _GNU_SOURCE
#define _LGPL_SOURCE
#include <assert.h>
index = relay_index_create(stream, net_seq_num);
if (!index) {
ERR("Cannot create index for stream id %" PRIu64 " and seq_num %" PRIu64,
- index->stream->stream_handle, net_seq_num);
+ stream->stream_handle, net_seq_num);
goto end;
}
oldindex = relay_index_add_unique(stream, index);
}
rcu_read_unlock();
}
+
+void relay_index_close_partial_fd(struct relay_stream *stream)
+{
+ struct lttng_ht_iter iter;
+ struct relay_index *index;
+
+ rcu_read_lock();
+ cds_lfht_for_each_entry(stream->indexes_ht->ht, &iter.iter,
+ index, index_n.node) {
+ if (!index->index_fd) {
+ continue;
+ }
+ /*
+ * Partial index has its index_fd: we have only
+ * received its info from the data socket.
+ * Put self-ref from index.
+ */
+ relay_index_put(index);
+ }
+ rcu_read_unlock();
+}
+
+uint64_t relay_index_find_last(struct relay_stream *stream)
+{
+ struct lttng_ht_iter iter;
+ struct relay_index *index;
+ uint64_t net_seq_num = -1ULL;
+
+ rcu_read_lock();
+ cds_lfht_for_each_entry(stream->indexes_ht->ht, &iter.iter,
+ index, index_n.node) {
+ if (net_seq_num == -1ULL ||
+ index->index_n.key > net_seq_num) {
+ net_seq_num = index->index_n.key;
+ }
+ }
+ rcu_read_unlock();
+ return net_seq_num;
+}