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

Move aggregation algorithm to separate function

This commit is contained in:
Igor Putovny 2024-05-16 14:48:14 +02:00
parent 4e29dd3f95
commit b572ad323d

View File

@ -906,14 +906,8 @@ calculate_trie(struct aggregator_proto *p)
}
static void
run_aggregation(struct channel *C)
run_aggregation(struct aggregator_proto *p)
{
struct aggregator_proto *p = (void *)C->proto;
/* Run aggregation only on feed-end from source channel */
if (C != p->src)
return;
construct_trie(p);
calculate_trie(p);
collect_prefixes(p);
@ -923,6 +917,16 @@ run_aggregation(struct channel *C)
log("==== AGGREGATION DONE ====");
}
static void
aggregate_on_feed_end(struct channel *C)
{
struct aggregator_proto *p = SKIP_BACK(struct aggregator_proto, p, C);
/* Run aggregation only on feed end from the source channel */
if (C == p->src)
run_aggregation(p);
}
/*
* Set static attribute in @rta from static attribute in @old according to @sa.
*/
@ -1532,7 +1536,7 @@ aggregator_init(struct proto_config *CF)
P->rt_notify = aggregator_rt_notify;
P->preexport = aggregator_preexport;
P->feed_end = run_aggregation;
P->feed_end = aggregate_on_feed_end;
return P;
}