mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-18 09:08:42 +00:00
Route subscription uses events
This commit is contained in:
parent
18f66055e3
commit
c7d0c5b252
17
nest/proto.c
17
nest/proto.c
@ -319,9 +319,9 @@ proto_remove_channels(struct proto *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
channel_roa_in_changed(struct rt_subscription *s)
|
channel_roa_in_changed(void *_data)
|
||||||
{
|
{
|
||||||
struct channel *c = s->data;
|
struct channel *c = _data;
|
||||||
|
|
||||||
CD(c, "Reload triggered by RPKI change");
|
CD(c, "Reload triggered by RPKI change");
|
||||||
|
|
||||||
@ -329,9 +329,9 @@ channel_roa_in_changed(struct rt_subscription *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
channel_roa_out_changed(struct rt_subscription *s)
|
channel_roa_out_changed(void *_data)
|
||||||
{
|
{
|
||||||
struct channel *c = s->data;
|
struct channel *c = _data;
|
||||||
CD(c, "Feeding triggered by RPKI change");
|
CD(c, "Feeding triggered by RPKI change");
|
||||||
|
|
||||||
c->refeed_pending = 1;
|
c->refeed_pending = 1;
|
||||||
@ -349,14 +349,14 @@ struct roa_subscription {
|
|||||||
static int
|
static int
|
||||||
channel_roa_is_subscribed(struct channel *c, rtable *tab, int dir)
|
channel_roa_is_subscribed(struct channel *c, rtable *tab, int dir)
|
||||||
{
|
{
|
||||||
void (*hook)(struct rt_subscription *) =
|
void (*hook)(void *) =
|
||||||
dir ? channel_roa_in_changed : channel_roa_out_changed;
|
dir ? channel_roa_in_changed : channel_roa_out_changed;
|
||||||
|
|
||||||
struct roa_subscription *s;
|
struct roa_subscription *s;
|
||||||
node *n;
|
node *n;
|
||||||
|
|
||||||
WALK_LIST2(s, n, c->roa_subscriptions, roa_node)
|
WALK_LIST2(s, n, c->roa_subscriptions, roa_node)
|
||||||
if ((s->s.tab == tab) && (s->s.hook == hook))
|
if ((s->s.tab == tab) && (s->s.event->hook == hook))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -370,9 +370,9 @@ channel_roa_subscribe(struct channel *c, rtable *tab, int dir)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
struct roa_subscription *s = mb_allocz(c->proto->pool, sizeof(struct roa_subscription));
|
struct roa_subscription *s = mb_allocz(c->proto->pool, sizeof(struct roa_subscription));
|
||||||
|
s->s.event = ev_new_init(c->proto->pool, dir ? channel_roa_in_changed : channel_roa_out_changed, c);
|
||||||
|
s->s.event->list = proto_work_list(c->proto);
|
||||||
|
|
||||||
s->s.hook = dir ? channel_roa_in_changed : channel_roa_out_changed;
|
|
||||||
s->s.data = c;
|
|
||||||
rt_subscribe(tab, &s->s);
|
rt_subscribe(tab, &s->s);
|
||||||
|
|
||||||
add_tail(&c->roa_subscriptions, &s->roa_node);
|
add_tail(&c->roa_subscriptions, &s->roa_node);
|
||||||
@ -383,6 +383,7 @@ channel_roa_unsubscribe(struct roa_subscription *s)
|
|||||||
{
|
{
|
||||||
rt_unsubscribe(&s->s);
|
rt_unsubscribe(&s->s);
|
||||||
rem_node(&s->roa_node);
|
rem_node(&s->roa_node);
|
||||||
|
rfree(s->s.event);
|
||||||
mb_free(s);
|
mb_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,8 +213,7 @@ typedef struct rtable {
|
|||||||
struct rt_subscription {
|
struct rt_subscription {
|
||||||
node n;
|
node n;
|
||||||
rtable *tab;
|
rtable *tab;
|
||||||
void (*hook)(struct rt_subscription *b);
|
event *event;
|
||||||
void *data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NHU_CLEAN 0
|
#define NHU_CLEAN 0
|
||||||
|
@ -1979,7 +1979,7 @@ rt_settle_timer(timer *t)
|
|||||||
|
|
||||||
struct rt_subscription *s;
|
struct rt_subscription *s;
|
||||||
WALK_LIST(s, tab->subscribers)
|
WALK_LIST(s, tab->subscribers)
|
||||||
s->hook(s);
|
ev_send(s->event->list, s->event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user