#include "nest/iface.h"
#include "filter/filter.h"
#include "proto/aggregator/aggregator.h"
-#include "lib/settle.h"
#include <stdlib.h>
#include <assert.h>
memset(p->bucket_list, 0, sizeof(p->bucket_list[0]) * p->bucket_list_size);
}
-static void
-request_feed_on_settle_timer(struct settle *s)
-{
- struct aggregator_proto *p = SKIP_BACK(struct aggregator_proto, p, s->tm.data);
-
- assert(PREFIX_AGGR == p->aggr_mode);
- assert(p->root == NULL);
-
- times_update(&main_timeloop);
- log("==== FEED START ====");
- channel_request_feeding(p->src);
-}
-
static void trie_init(struct aggregator_proto *p);
static void
if (p->p.proto_state != PS_UP)
return;
- if (PREFIX_AGGR == p->aggr_mode)
- {
- assert(p->root == NULL);
-
- /*
- * Don't kick settle timer during initial feed. That would cause
- * cyclic calls to rt_notify() without receiving any new updates.
- */
- if (!p->first_run)
- settle_kick(&p->notify_settle);
- }
/* Find the objects for the old route */
if (old)
p->aggr_on_da_count = cf->aggr_on_da_count;
p->aggr_on = cf->aggr_on;
p->merge_by = cf->merge_by;
- p->notify_settle_cf = cf->notify_settle_cf;
p->logging = cf->logging;
p->bucket_list = NULL;
p->bucket_list_size = 0;
{
assert(p->trie_pool == NULL);
p->trie_pool = lp_new(P->pool);
- settle_init(&p->notify_settle, &p->notify_settle_cf, request_feed_on_settle_timer, p);
assert(p->bucket_list == NULL);
assert(p->bucket_list_size == 0);
{
struct aggregator_proto *p = SKIP_BACK(struct aggregator_proto, p, P);
- settle_cancel(&p->notify_settle);
-
assert(p->root == NULL);
flush_aggregator(p);
{
struct aggregator_proto *p = SKIP_BACK(struct aggregator_proto, p, P);
- assert(!tm_active(&p->notify_settle.tm));
-
/*
* Linpools will be freed with other protocol resources but pointers
* have to be erased because protocol may be started again
TRACE(D_EVENTS, "Reconfiguring");
- /* Compare timer configuration */
- if (cf->notify_settle_cf.min != p->notify_settle_cf.min || cf->notify_settle_cf.max != p->notify_settle_cf.max)
- return 0;
-
/* Compare numeric values (shortcut) */
if (cf->aggr_on_count != p->aggr_on_count)
return 0;
CF_HDR
#include "proto/aggregator/aggregator.h"
-#include "lib/settle.h"
CF_DEFINES
AGGREGATOR_CFG->src->ra_mode = RA_OPTIMAL;
AGGREGATOR_CFG->dst->ra_mode = RA_ANY;
AGGREGATOR_CFG->logging = 0;
-
- AGGREGATOR_CFG->notify_settle_cf = (struct settle_config) {
- .min = 10 MS_,
- .max = 100 MS_,
- };
};
aggregator_proto_item:
$4->args++;
AGGREGATOR_CFG->merge_by = $4;
}
- | RELOAD AFTER settle { AGGREGATOR_CFG->notify_settle_cf = $3; }
| LOG ALL { AGGREGATOR_CFG->logging = 1; }
;
}
;
-/* Settle timer configuration */
-settle:
- expr_us expr_us {
- if ($1 > $2)
- cf_error("Minimum settle time %t is bigger than maximum settle time %t", $1, $2);
- $$.min = $1 MS_;
- $$.max = $2 MS_;
- }
- ;
-
CF_CODE
CF_END