0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 12:18:42 +00:00

Babel now runs in the worker thread

This commit is contained in:
Maria Matejka 2024-04-13 15:55:52 +02:00
parent 5d5c431a3c
commit 44d4466e88
3 changed files with 8 additions and 7 deletions

View File

@ -1752,14 +1752,14 @@ babel_iface_timer(timer *t)
btime next_event = MIN(ifa->next_hello, ifa->next_regular); btime next_event = MIN(ifa->next_hello, ifa->next_regular);
if (ifa->want_triggered) next_event = MIN(next_event, ifa->next_triggered); if (ifa->want_triggered) next_event = MIN(next_event, ifa->next_triggered);
tm_set(ifa->timer, next_event); tm_set_in(ifa->timer, next_event, p->p.loop);
} }
static inline void static inline void
babel_iface_kick_timer(struct babel_iface *ifa) babel_iface_kick_timer(struct babel_iface *ifa)
{ {
if (ifa->timer->expires > (current_time() + 100 MS)) if (ifa->timer->expires > (current_time() + 100 MS))
tm_start(ifa->timer, 100 MS); tm_start_in(ifa->timer, 100 MS, ifa->proto->p.loop);
} }
static void static void
@ -1773,7 +1773,7 @@ babel_iface_start(struct babel_iface *ifa)
ifa->next_regular = current_time() + (random() % ifa->cf->update_interval); ifa->next_regular = current_time() + (random() % ifa->cf->update_interval);
ifa->next_triggered = current_time() + MIN(1 S, ifa->cf->update_interval / 2); ifa->next_triggered = current_time() + MIN(1 S, ifa->cf->update_interval / 2);
ifa->want_triggered = 0; /* We send an immediate update (below) */ ifa->want_triggered = 0; /* We send an immediate update (below) */
tm_start(ifa->timer, 100 MS); tm_start_in(ifa->timer, 100 MS, p->p.loop);
ifa->up = 1; ifa->up = 1;
babel_send_hello(ifa, 0); babel_send_hello(ifa, 0);
@ -1938,7 +1938,7 @@ babel_add_iface(struct babel_proto *p, struct iface *new, struct babel_iface_con
.hook = babel_iface_locked, .hook = babel_iface_locked,
.data = ifa, .data = ifa,
}; };
lock->target = &global_event_list; lock->target = birdloop_event_list(p->p.loop);
olock_acquire(lock); olock_acquire(lock);
} }
@ -2416,7 +2416,7 @@ static inline void
babel_kick_timer(struct babel_proto *p) babel_kick_timer(struct babel_proto *p)
{ {
if (p->timer->expires > (current_time() + 100 MS)) if (p->timer->expires > (current_time() + 100 MS))
tm_start(p->timer, 100 MS); tm_start_in(p->timer, 100 MS, p->p.loop);
} }
@ -2630,7 +2630,7 @@ babel_start(struct proto *P)
init_list(&p->interfaces); init_list(&p->interfaces);
p->timer = tm_new_init(P->pool, babel_timer, p, 1 S, 0); p->timer = tm_new_init(P->pool, babel_timer, p, 1 S, 0);
tm_start(p->timer, 1 S); tm_start_in(p->timer, 1 S, p->p.loop);
p->update_seqno = 1; p->update_seqno = 1;
p->router_id = proto_get_router_id(&cf->c); p->router_id = proto_get_router_id(&cf->c);

View File

@ -35,6 +35,7 @@ proto: babel_proto ;
babel_proto_start: proto_start BABEL babel_proto_start: proto_start BABEL
{ {
this_proto = proto_config_new(&proto_babel, $1); this_proto = proto_config_new(&proto_babel, $1);
this_proto->loop_order = DOMAIN_ORDER(proto);
init_list(&BABEL_CFG->iface_list); init_list(&BABEL_CFG->iface_list);
BABEL_CFG->hold_time = 1 S_; BABEL_CFG->hold_time = 1 S_;
}; };

View File

@ -1533,7 +1533,7 @@ babel_kick_queue(struct babel_iface *ifa)
*/ */
if ((ifa->sk->tpos == ifa->sk->tbuf) && !ev_active(ifa->send_event)) if ((ifa->sk->tpos == ifa->sk->tbuf) && !ev_active(ifa->send_event))
ev_schedule(ifa->send_event); ev_send_loop(ifa->proto->p.loop, ifa->send_event);
} }
/** /**