From 4243f9db124bfcc2d448203488ec0576fb965faa Mon Sep 17 00:00:00 2001 From: Igor Putovny Date: Thu, 13 Jun 2024 16:36:12 +0200 Subject: [PATCH] Kick settle timer when receiving updates in rt_notify() --- proto/aggregator/aggregator.c | 21 +++++++++++++++------ proto/aggregator/aggregator.h | 1 - 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/proto/aggregator/aggregator.c b/proto/aggregator/aggregator.c index da6cf4a14..b57260a91 100644 --- a/proto/aggregator/aggregator.c +++ b/proto/aggregator/aggregator.c @@ -1317,10 +1317,22 @@ aggregator_rt_notify(struct proto *P, struct channel *src_ch, net *net, rte *new if (p->p.proto_state != PS_UP) return; - if (!p->root) - trie_init(p); + if (PREFIX_AGGR == p->aggr_mode) + { + assert(p->root == NULL); - channel_request_feeding(p->src); + /* + * Don't kick settle timer during first run. That would cause + * repeated calls to rt_notify() without any new updates. + */ + if (!p->first_run) + { + log("rt notify: kick"); + settle_kick(&p->notify_settle); + } + + return; + } /* Find the objects for the old route */ if (old) @@ -1501,9 +1513,6 @@ aggregator_rt_notify(struct proto *P, struct channel *src_ch, net *net, rte *new ASSERT_DIE(!old_bucket->rte && !old_bucket->count); HASH_REMOVE2(p->buckets, AGGR_BUCK, p->p.pool, old_bucket); } - - assert(p->root != NULL); - settle_kick(&p->notify_settle); } static int diff --git a/proto/aggregator/aggregator.h b/proto/aggregator/aggregator.h index cac0813f6..61f6ff3d5 100644 --- a/proto/aggregator/aggregator.h +++ b/proto/aggregator/aggregator.h @@ -81,7 +81,6 @@ struct aggregator_proto { struct settle notify_settle; int before_count; int after_count; - int aggr_done; }; enum aggr_item_type { -- 2.47.2