diff options
author | Maria Matejka <mq@ucw.cz> | 2022-08-03 20:01:42 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-08-03 20:01:42 +0200 |
commit | 74eb4bad5fc8bef867fb4306185644aa1aa39d2b (patch) | |
tree | 7efda2f9988317e65ebf7f2b898fb3c896185fd3 /nest | |
parent | e60b83d8ac361fc838d7ca0917f92aa96860312a (diff) | |
parent | c7d0c5b2523a8cbfcaee9a235955dd5e58fab671 (diff) |
Merge commit 'c7d0c5b2' into thread-next
Diffstat (limited to 'nest')
-rw-r--r-- | nest/proto.c | 17 | ||||
-rw-r--r-- | nest/rt-table.c | 2 | ||||
-rw-r--r-- | nest/rt.h | 4 |
3 files changed, 12 insertions, 11 deletions
diff --git a/nest/proto.c b/nest/proto.c index e64cef28..853b1cf9 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -313,9 +313,9 @@ proto_remove_channels(struct proto *p) } 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; int active = !!c->reload_req.hook; CD(c, "Reload triggered by RPKI change%s", active ? " - already active" : ""); @@ -327,9 +327,9 @@ channel_roa_in_changed(struct rt_subscription *s) } 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"); c->refeed_pending = 1; @@ -347,14 +347,14 @@ struct roa_subscription { static int 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; struct roa_subscription *s; node *n; 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 0; @@ -368,9 +368,9 @@ channel_roa_subscribe(struct channel *c, rtable *tab, int dir) return; 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.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); add_tail(&c->roa_subscriptions, &s->roa_node); @@ -381,6 +381,7 @@ channel_roa_unsubscribe(struct roa_subscription *s) { rt_unsubscribe(&s->s); rem_node(&s->roa_node); + rfree(s->s.event); mb_free(s); } diff --git a/nest/rt-table.c b/nest/rt-table.c index d58b7298..3ade4237 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -2436,7 +2436,7 @@ rt_settle_timer(timer *t) struct rt_subscription *s; WALK_LIST(s, tab->subscribers) - s->hook(s); + ev_send(s->list, s->event); } static void @@ -139,8 +139,8 @@ typedef struct rtable { struct rt_subscription { node n; rtable *tab; - void (*hook)(struct rt_subscription *b); - void *data; + event *event; + event_list *list; }; struct rt_flowspec_link { |