0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

Request feed when settle timer triggers and initialize trie just before aggregation

This commit is contained in:
Igor Putovny 2024-06-13 13:08:42 +02:00
parent f5701ed913
commit 701a9f5dd1

View File

@ -908,29 +908,37 @@ flush_aggregator(struct aggregator_proto *p)
} }
static void static void
aggregate_on_settle_timer(struct settle *s) request_feed_on_settle_timer(struct settle *s)
{ {
struct aggregator_proto *p = SKIP_BACK(struct aggregator_proto, p, s->tm.data); struct aggregator_proto *p = SKIP_BACK(struct aggregator_proto, p, s->tm.data);
if (!p->aggr_done) assert(PREFIX_AGGR == p->aggr_mode);
{ log("Request feed on settle timer: aggr mode is PREFIX_AGGR");
run_aggregation(p); assert(p->root == NULL);
p->aggr_done = 1;
} log("Request feed on settle timer: requesting feed on src channel");
else channel_request_feeding(p->src);
log("Aggregation is already finished");
} }
static void trie_init(struct aggregator_proto *p);
static void static void
aggregate_on_feed_end(struct channel *C) aggregate_on_feed_end(struct channel *C)
{ {
struct aggregator_proto *p = SKIP_BACK(struct aggregator_proto, p, C->proto); struct aggregator_proto *p = SKIP_BACK(struct aggregator_proto, p, C->proto);
assert(PREFIX_AGGR == p->aggr_mode);
assert(p->root == NULL);
if (C == p->src) if (C == p->src)
{ {
trie_init(p);
run_aggregation(p); run_aggregation(p);
flush_aggregator(p); flush_aggregator(p);
p->root = NULL; p->root = NULL;
p->before_count = 0;
p->after_count = 0;
if (p->first_run) if (p->first_run)
p->first_run = 0; p->first_run = 0;
@ -1297,8 +1305,6 @@ HASH_DEFINE_REHASH_FN(AGGR_BUCK, struct aggregator_bucket);
#define AGGR_DATA_MEMSIZE (sizeof(struct f_val) * p->aggr_on_count) #define AGGR_DATA_MEMSIZE (sizeof(struct f_val) * p->aggr_on_count)
static void trie_init(struct aggregator_proto *p);
static void static void
aggregator_rt_notify(struct proto *P, struct channel *src_ch, net *net, rte *new, rte *old) aggregator_rt_notify(struct proto *P, struct channel *src_ch, net *net, rte *new, rte *old)
{ {