From 812e646625e5be2dc19255ead17abe005d81a759 Mon Sep 17 00:00:00 2001 From: Igor Putovny Date: Fri, 15 Sep 2023 11:04:37 +0200 Subject: [PATCH] Move trie initialization to aggregator_start() --- proto/aggregator/aggregator.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/proto/aggregator/aggregator.c b/proto/aggregator/aggregator.c index acd33e4e..254a9e80 100644 --- a/proto/aggregator/aggregator.c +++ b/proto/aggregator/aggregator.c @@ -109,13 +109,7 @@ remove_node(struct trie_node *node) } static void -trie_init(struct aggregator_proto *p) { - static int inits = 0; - p->trie_slab = sl_new(p->p.pool, sizeof(struct trie_node)); - p->root = new_node(p->trie_slab); - inits++; - log("Trie inits: %d", inits); } /* @@ -1161,8 +1155,6 @@ aggregator_rt_notify(struct proto *P, struct channel *src_ch, net *net, rte *new sl_free(old_route); } - trie_init(p); - HASH_WALK(p->buckets, next_hash, bucket) { for (const struct rte *rte = bucket->rte; rte; rte = rte->next) @@ -1307,6 +1299,9 @@ aggregator_start(struct proto *P) .data = p, }; + p->trie_slab = sl_new(p->p.pool, sizeof(struct trie_node)); + p->root = new_node(p->trie_slab); + return PS_UP; }