iter.iter.node = &channel->node.node;
ret = lttng_ht_del(consumer_data.channel_ht, &iter);
assert(!ret);
+
+ iter.iter.node = &channel->channels_by_session_id_ht_node.node;
+ ret = lttng_ht_del(consumer_data.channels_by_session_id_ht, &iter);
+ assert(!ret);
rcu_read_unlock();
call_rcu(&channel->node.head, free_channel_rcu);
}
lttng_ht_node_init_u64(&channel->node, channel->key);
+ lttng_ht_node_init_u64(&channel->channels_by_session_id_ht_node,
+ channel->session_id);
channel->wait_fd = -1;
rcu_read_lock();
lttng_ht_add_unique_u64(consumer_data.channel_ht, &channel->node);
+ lttng_ht_add_u64(consumer_data.channels_by_session_id_ht,
+ &channel->channels_by_session_id_ht_node);
rcu_read_unlock();
pthread_mutex_unlock(&channel->timer_lock);
rcu_read_unlock();
lttng_ht_destroy(consumer_data.channel_ht);
+ lttng_ht_destroy(consumer_data.channels_by_session_id_ht);
cleanup_relayd_ht();
goto error;
}
+ consumer_data.channels_by_session_id_ht =
+ lttng_ht_new(0, LTTNG_HT_TYPE_U64);
+ if (!consumer_data.channels_by_session_id_ht) {
+ goto error;
+ }
+
consumer_data.relayd_ht = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
if (!consumer_data.relayd_ht) {
goto error;
struct lttng_consumer_channel {
/* HT node used for consumer_data.channel_ht */
struct lttng_ht_node_u64 node;
+ /* HT node used for consumer_data.channels_by_session_id_ht */
+ struct lttng_ht_node_u64 channels_by_session_id_ht_node;
/* Indexed key. Incremented value in the consumer. */
uint64_t key;
/* Number of streams referencing this channel */
/* Channel hash table protected by consumer_data.lock. */
struct lttng_ht *channel_ht;
+ /* Channel hash table indexed by session id. */
+ struct lttng_ht *channels_by_session_id_ht;
/*
* Flag specifying if the local array of FDs needs update in the
* poll function. Protected by consumer_data.lock.