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

Settle timer - minor changes

This commit is contained in:
Vojtech Vilimek 2022-07-26 14:53:21 +02:00
parent 374ee57466
commit 84a7cb1c60
3 changed files with 10 additions and 7 deletions

View File

@ -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();

View File

@ -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

View File

@ -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;