diff options
Diffstat (limited to 'nest')
-rw-r--r-- | nest/proto.c | 18 | ||||
-rw-r--r-- | nest/rt-table.c | 12 |
2 files changed, 21 insertions, 9 deletions
diff --git a/nest/proto.c b/nest/proto.c index 1b25dfe9..d6269272 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -1116,8 +1116,11 @@ proto_cleanup(struct proto *p) { CALL(p->proto->cleanup, p); - rp_free(p->pool); - p->pool = NULL; + if (p->pool) + { + rp_free(p->pool); + p->pool = NULL; + } p->active = 0; proto_log_state_change(p); @@ -1131,8 +1134,10 @@ proto_loop_stopped(void *ptr) birdloop_enter(&main_birdloop); + p->pool = NULL; /* is freed by birdloop_free() */ birdloop_free(p->loop); p->loop = &main_birdloop; + proto_cleanup(p); birdloop_leave(&main_birdloop); @@ -1214,13 +1219,16 @@ proto_start(struct proto *p) DBG("Kicking %s up\n", p->name); PD(p, "Starting"); - p->pool = rp_newf(proto_pool, "Protocol %s", p->cf->name); - if (graceful_restart_state == GRS_INIT) p->gr_recovery = 1; if (p->cf->loop_order != DOMAIN_ORDER(the_bird)) - p->loop = birdloop_new(p->pool, p->cf->loop_order, p->pool->name, p->cf->loop_max_latency); + { + p->loop = birdloop_new(proto_pool, p->cf->loop_order, p->cf->loop_max_latency, "Protocol %s", p->cf->name); + p->pool = birdloop_pool(p->loop); + } + else + p->pool = rp_newf(proto_pool, "Protocol %s", p->cf->name); p->iface_sub.target = proto_event_list(p); diff --git a/nest/rt-table.c b/nest/rt-table.c index cec13318..9629db2c 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -2845,10 +2845,15 @@ rt_setup(pool *pp, struct rtable_config *cf) { ASSERT_DIE(birdloop_inside(&main_birdloop)); - pool *p = rp_newf(pp, "Routing table %s", cf->name); + /* Start the service thread */ + struct birdloop *loop = birdloop_new(pp, DOMAIN_ORDER(service), 0, "Routing table service %s", cf->name); + pool *sp = birdloop_pool(loop); + pool *p = rp_newf(sp, "Routing table data %s", cf->name); + /* Create the actual table */ struct rtable_private *t = ralloc(p, &rt_class); t->rp = p; + t->loop = loop; t->rte_slab = sl_new(p, sizeof(struct rte_storage)); @@ -2906,8 +2911,7 @@ rt_setup(pool *pp, struct rtable_config *cf) t->flowspec_trie->ipv4 = (t->addr_type == NET_FLOW4); } - /* Start the service thread */ - t->loop = birdloop_new(p, DOMAIN_ORDER(service), mb_sprintf(p, "Routing table %s", t->name), 0); + /* Setup the service thread flag handler */ birdloop_enter(t->loop); birdloop_flag_set_handler(t->loop, &t->fh); birdloop_leave(t->loop); @@ -4073,8 +4077,8 @@ rt_delete(void *tab_) RT_UNLOCK(RT_PUB(tab)); + /* Everything is freed by freeing the loop */ birdloop_free(tab->loop); - rfree(tab->rp); config_del_obstacle(conf); birdloop_leave(&main_birdloop); |