diff --git a/lib/timer.c b/lib/timer.c index ec8dd3e3..a975a3ef 100644 --- a/lib/timer.c +++ b/lib/timer.c @@ -382,14 +382,18 @@ tm_format_real_time(char *x, size_t max, const char *fmt, btime t) * Settle timer */ -static btime +static inline btime settled_time(struct settle_timer *st) { + ASSUME(st->base_settle_time != 0); + if (st->base_settle_time + *(st->max_settle_time) < + st->last_change + *(st->min_settle_time)) + log(L_INFO "settle_timer will be triggered by MAX SETTLE TIME"); return MIN_(st->last_change + *(st->min_settle_time), st->base_settle_time + *(st->max_settle_time)); } -void +inline void settle_timer_changed(struct settle_timer *st) { st->last_change = current_time(); @@ -398,7 +402,6 @@ settle_timer_changed(struct settle_timer *st) void settle_timer(timer *t) { - log(L_INFO "settle_timer()"); struct settle_timer *st = (void *) t; if (!st->base_settle_time) @@ -421,7 +424,6 @@ settle_timer(timer *t) struct settle_timer * stm_new_timer(pool *p, void *data, struct settle_timer_class *class) { - log(L_INFO "stm_new_timer() creating new timer"); struct settle_timer *st; st = mb_allocz(p, sizeof(struct settle_timer)); st->class = class; @@ -438,7 +440,6 @@ stm_new_timer(pool *p, void *data, struct settle_timer_class *class) void kick_settle_timer(struct settle_timer *st) { - log(L_INFO "kick_settle_timer()"); ASSUME(st != NULL); st->base_settle_time = current_time(); diff --git a/lib/timer.h b/lib/timer.h index 89663ec4..00950e08 100644 --- a/lib/timer.h +++ b/lib/timer.h @@ -145,5 +145,6 @@ struct settle_timer_class { struct settle_timer *stm_new_timer(pool *p, void *data, struct settle_timer_class *class); void kick_settle_timer(struct settle_timer *st); +void settle_timer_changed(struct settle_timer *st); #endif diff --git a/nest/rt-table.c b/nest/rt-table.c index 3d11c7dc..428628eb 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -1365,7 +1365,7 @@ rte_recalculate(struct rt_import_hook *c, net *net, rte *new, struct rte_src *sr stats->withdraws_ignored++; if (old_ok || new_ok) - table->settle_timer->last_change = current_time(); + settle_timer_changed(table->settle_timer); if (table->config->sorted) { @@ -2346,7 +2346,8 @@ rt_setup(pool *pp, struct rtable_config *cf) t->prune_timer = tm_new_init(p, rt_prune_timer, t, 0, 0); t->settle_timer = stm_new_timer(p, t, &rt_settle_class); - t->settle_timer->last_change = t->gc_time = current_time(); + settle_timer_changed(t->settle_timer); + t->gc_time = current_time(); t->rl_pipe = (struct tbf) TBF_DEFAULT_LOG_LIMITS;