mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-23 02:01:55 +00:00
Settle timer - minor changes
This commit is contained in:
parent
374ee57466
commit
84a7cb1c60
11
lib/timer.c
11
lib/timer.c
@ -382,14 +382,18 @@ tm_format_real_time(char *x, size_t max, const char *fmt, btime t)
|
|||||||
* Settle timer
|
* Settle timer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static btime
|
static inline btime
|
||||||
settled_time(struct settle_timer *st)
|
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),
|
return MIN_(st->last_change + *(st->min_settle_time),
|
||||||
st->base_settle_time + *(st->max_settle_time));
|
st->base_settle_time + *(st->max_settle_time));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
inline void
|
||||||
settle_timer_changed(struct settle_timer *st)
|
settle_timer_changed(struct settle_timer *st)
|
||||||
{
|
{
|
||||||
st->last_change = current_time();
|
st->last_change = current_time();
|
||||||
@ -398,7 +402,6 @@ settle_timer_changed(struct settle_timer *st)
|
|||||||
void
|
void
|
||||||
settle_timer(timer *t)
|
settle_timer(timer *t)
|
||||||
{
|
{
|
||||||
log(L_INFO "settle_timer()");
|
|
||||||
struct settle_timer *st = (void *) t;
|
struct settle_timer *st = (void *) t;
|
||||||
|
|
||||||
if (!st->base_settle_time)
|
if (!st->base_settle_time)
|
||||||
@ -421,7 +424,6 @@ settle_timer(timer *t)
|
|||||||
struct settle_timer *
|
struct settle_timer *
|
||||||
stm_new_timer(pool *p, void *data, struct settle_timer_class *class)
|
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;
|
struct settle_timer *st;
|
||||||
st = mb_allocz(p, sizeof(struct settle_timer));
|
st = mb_allocz(p, sizeof(struct settle_timer));
|
||||||
st->class = class;
|
st->class = class;
|
||||||
@ -438,7 +440,6 @@ stm_new_timer(pool *p, void *data, struct settle_timer_class *class)
|
|||||||
void
|
void
|
||||||
kick_settle_timer(struct settle_timer *st)
|
kick_settle_timer(struct settle_timer *st)
|
||||||
{
|
{
|
||||||
log(L_INFO "kick_settle_timer()");
|
|
||||||
ASSUME(st != NULL);
|
ASSUME(st != NULL);
|
||||||
|
|
||||||
st->base_settle_time = current_time();
|
st->base_settle_time = current_time();
|
||||||
|
@ -145,5 +145,6 @@ struct settle_timer_class {
|
|||||||
|
|
||||||
struct settle_timer *stm_new_timer(pool *p, void *data, struct settle_timer_class *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 kick_settle_timer(struct settle_timer *st);
|
||||||
|
void settle_timer_changed(struct settle_timer *st);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1365,7 +1365,7 @@ rte_recalculate(struct rt_import_hook *c, net *net, rte *new, struct rte_src *sr
|
|||||||
stats->withdraws_ignored++;
|
stats->withdraws_ignored++;
|
||||||
|
|
||||||
if (old_ok || new_ok)
|
if (old_ok || new_ok)
|
||||||
table->settle_timer->last_change = current_time();
|
settle_timer_changed(table->settle_timer);
|
||||||
|
|
||||||
if (table->config->sorted)
|
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->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 = 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;
|
t->rl_pipe = (struct tbf) TBF_DEFAULT_LOG_LIMITS;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user