From: Igor Putovny Date: Tue, 21 Nov 2023 11:58:24 +0000 (+0100) Subject: Create event to run ORTC algorithm exactly once X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b574c62d57510e177d6e9cd575159f8f2f746066;p=thirdparty%2Fbird.git Create event to run ORTC algorithm exactly once --- diff --git a/proto/aggregator/aggregator.c b/proto/aggregator/aggregator.c index 2ed6f55c7..f520ae0c9 100644 --- a/proto/aggregator/aggregator.c +++ b/proto/aggregator/aggregator.c @@ -1178,6 +1178,7 @@ aggregator_rt_notify(struct proto *P, struct channel *src_ch, net *net, rte *new } HASH_WALK_END; + ev_schedule(&p->reload_trie); /* Announce changes */ if (old_bucket) @@ -1275,6 +1276,11 @@ aggregator_start(struct proto *P) p->trie_slab = sl_new(p->p.pool, sizeof(struct trie_node)); p->root = new_node(p->trie_slab); + p->reload_trie = (event) { + .hook = calculate_trie, + .data = p, + }; + return PS_UP; } @@ -1301,6 +1307,7 @@ aggregator_shutdown(struct proto *P) } HASH_WALK_END; + ev_postpone(&p->reload_trie); delete_trie(p->root); p->root = NULL; diff --git a/proto/aggregator/aggregator.h b/proto/aggregator/aggregator.h index 2d0a6167c..22638ac21 100644 --- a/proto/aggregator/aggregator.h +++ b/proto/aggregator/aggregator.h @@ -67,6 +67,8 @@ struct aggregator_proto { /* Aggregation trie */ slab *trie_slab; struct trie_node *root; + + struct event reload_trie; }; enum aggr_item_type {