mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 01:31:55 +00:00
Lib: Add and use ev_new_init()
This commit is contained in:
parent
0db7a1d69c
commit
961671c0f5
@ -36,5 +36,14 @@ ev_active(event *e)
|
|||||||
return e->n.next != NULL;
|
return e->n.next != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline event*
|
||||||
|
ev_new_init(pool *p, void (*hook)(void *), void *data)
|
||||||
|
{
|
||||||
|
event *e = ev_new(p);
|
||||||
|
e->hook = hook;
|
||||||
|
e->data = data;
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -191,6 +191,5 @@ olock_init(void)
|
|||||||
{
|
{
|
||||||
DBG("olock: init\n");
|
DBG("olock: init\n");
|
||||||
init_list(&olock_list);
|
init_list(&olock_list);
|
||||||
olock_event = ev_new(&root_pool);
|
olock_event = ev_new_init(&root_pool, olock_run_event, NULL);
|
||||||
olock_event->hook = olock_run_event;
|
|
||||||
}
|
}
|
||||||
|
@ -291,9 +291,7 @@ channel_do_start(struct channel *c)
|
|||||||
add_tail(&c->table->channels, &c->table_node);
|
add_tail(&c->table->channels, &c->table_node);
|
||||||
c->proto->active_channels++;
|
c->proto->active_channels++;
|
||||||
|
|
||||||
c->feed_event = ev_new(c->proto->pool);
|
c->feed_event = ev_new_init(c->proto->pool, channel_feed_loop, c);
|
||||||
c->feed_event->data = c;
|
|
||||||
c->feed_event->hook = channel_feed_loop;
|
|
||||||
|
|
||||||
channel_reset_limit(&c->rx_limit);
|
channel_reset_limit(&c->rx_limit);
|
||||||
channel_reset_limit(&c->in_limit);
|
channel_reset_limit(&c->in_limit);
|
||||||
@ -702,9 +700,7 @@ proto_init(struct proto_config *c, node *n)
|
|||||||
p->vrf = c->vrf;
|
p->vrf = c->vrf;
|
||||||
insert_node(&p->n, n);
|
insert_node(&p->n, n);
|
||||||
|
|
||||||
p->event = ev_new(proto_pool);
|
p->event = ev_new_init(proto_pool, proto_event, p);
|
||||||
p->event->hook = proto_event;
|
|
||||||
p->event->data = p;
|
|
||||||
|
|
||||||
PD(p, "Initializing%s", p->disabled ? " [disabled]" : "");
|
PD(p, "Initializing%s", p->disabled ? " [disabled]" : "");
|
||||||
|
|
||||||
|
@ -1682,9 +1682,7 @@ rt_setup(pool *p, rtable *t, struct rtable_config *cf)
|
|||||||
fib_init(&t->fib, p, t->addr_type, sizeof(net), OFFSETOF(net, n), 0, NULL);
|
fib_init(&t->fib, p, t->addr_type, sizeof(net), OFFSETOF(net, n), 0, NULL);
|
||||||
init_list(&t->channels);
|
init_list(&t->channels);
|
||||||
|
|
||||||
t->rt_event = ev_new(p);
|
t->rt_event = ev_new_init(p, rt_event, t);
|
||||||
t->rt_event->hook = rt_event;
|
|
||||||
t->rt_event->data = t;
|
|
||||||
t->gc_time = current_time();
|
t->gc_time = current_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1592,9 +1592,7 @@ babel_add_iface(struct babel_proto *p, struct iface *new, struct babel_iface_con
|
|||||||
ifa->timer = tm_new_init(ifa->pool, babel_iface_timer, ifa, 0, 0);
|
ifa->timer = tm_new_init(ifa->pool, babel_iface_timer, ifa, 0, 0);
|
||||||
|
|
||||||
init_list(&ifa->msg_queue);
|
init_list(&ifa->msg_queue);
|
||||||
ifa->send_event = ev_new(ifa->pool);
|
ifa->send_event = ev_new_init(ifa->pool, babel_send_queue, ifa);
|
||||||
ifa->send_event->hook = babel_send_queue;
|
|
||||||
ifa->send_event->data = ifa;
|
|
||||||
|
|
||||||
struct object_lock *lock = olock_new(ifa->pool);
|
struct object_lock *lock = olock_new(ifa->pool);
|
||||||
lock->type = OBJLOCK_UDP;
|
lock->type = OBJLOCK_UDP;
|
||||||
|
@ -977,9 +977,7 @@ bgp_setup_conn(struct bgp_proto *p, struct bgp_conn *conn)
|
|||||||
conn->hold_timer = tm_new_init(p->p.pool, bgp_hold_timeout, conn, 0, 0);
|
conn->hold_timer = tm_new_init(p->p.pool, bgp_hold_timeout, conn, 0, 0);
|
||||||
conn->keepalive_timer = tm_new_init(p->p.pool, bgp_keepalive_timeout, conn, 0, 0);
|
conn->keepalive_timer = tm_new_init(p->p.pool, bgp_keepalive_timeout, conn, 0, 0);
|
||||||
|
|
||||||
conn->tx_ev = ev_new(p->p.pool);
|
conn->tx_ev = ev_new_init(p->p.pool, bgp_kick_tx, conn);
|
||||||
conn->tx_ev->hook = bgp_kick_tx;
|
|
||||||
conn->tx_ev->data = conn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1402,10 +1400,7 @@ bgp_start(struct proto *P)
|
|||||||
p->gr_ready = 0;
|
p->gr_ready = 0;
|
||||||
p->gr_active_num = 0;
|
p->gr_active_num = 0;
|
||||||
|
|
||||||
p->event = ev_new(p->p.pool);
|
p->event = ev_new_init(p->p.pool, bgp_decision, p);
|
||||||
p->event->hook = bgp_decision;
|
|
||||||
p->event->data = p;
|
|
||||||
|
|
||||||
p->startup_timer = tm_new_init(p->p.pool, bgp_startup_timeout, p, 0, 0);
|
p->startup_timer = tm_new_init(p->p.pool, bgp_startup_timeout, p, 0, 0);
|
||||||
p->gr_timer = tm_new_init(p->p.pool, bgp_graceful_restart_timeout, p, 0, 0);
|
p->gr_timer = tm_new_init(p->p.pool, bgp_graceful_restart_timeout, p, 0, 0);
|
||||||
|
|
||||||
|
@ -256,9 +256,7 @@ ospf_start(struct proto *P)
|
|||||||
p->gr = ospf_top_new(p, P->pool);
|
p->gr = ospf_top_new(p, P->pool);
|
||||||
s_init_list(&(p->lsal));
|
s_init_list(&(p->lsal));
|
||||||
|
|
||||||
p->flood_event = ev_new(P->pool);
|
p->flood_event = ev_new_init(P->pool, ospf_flood_event, p);
|
||||||
p->flood_event->hook = ospf_flood_event;
|
|
||||||
p->flood_event->data = p;
|
|
||||||
|
|
||||||
p->log_pkt_tbf = (struct tbf){ .rate = 1, .burst = 5 };
|
p->log_pkt_tbf = (struct tbf){ .rate = 1, .burst = 5 };
|
||||||
p->log_lsa_tbf = (struct tbf){ .rate = 4, .burst = 20 };
|
p->log_lsa_tbf = (struct tbf){ .rate = 4, .burst = 20 };
|
||||||
|
@ -420,9 +420,7 @@ static_start(struct proto *P)
|
|||||||
if (p->igp_table_ip6)
|
if (p->igp_table_ip6)
|
||||||
rt_lock_table(p->igp_table_ip6);
|
rt_lock_table(p->igp_table_ip6);
|
||||||
|
|
||||||
p->event = ev_new(p->p.pool);
|
p->event = ev_new_init(p->p.pool, static_announce_marked, p);
|
||||||
p->event->hook = static_announce_marked;
|
|
||||||
p->event->data = p;
|
|
||||||
|
|
||||||
BUFFER_INIT(p->marked, p->p.pool, 4);
|
BUFFER_INIT(p->marked, p->p.pool, 4);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user