diff options
author | Maria Matejka <mq@ucw.cz> | 2023-03-06 13:16:12 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2023-04-04 17:00:58 +0200 |
commit | 03bfb8b59dbd6da41990d717a639662aeb31c144 (patch) | |
tree | 6d820a88c95e45b0307545aef563fbf87178d347 /nest | |
parent | 9073eda854ecee61f723894e66036de266e63606 (diff) |
Moved table hostcache updater to table service routines to not bother the mainloop
Diffstat (limited to 'nest')
-rw-r--r-- | nest/rt-table.c | 23 | ||||
-rw-r--r-- | nest/rt.h | 1 |
2 files changed, 15 insertions, 9 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c index a737e1b3..fab8f06d 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -2573,6 +2573,14 @@ rt_flag_handler(struct birdloop_flag_handler *fh, u32 flags) rt_prune_table(tab); } + if (flags & RTF_DELETE) + { + if (tab->hostcache) + rt_stop_export(&tab->hostcache->req, NULL); + + rt_unlock_table(tab); + } + rt_unlock_table(tab); } } @@ -4155,16 +4163,13 @@ rt_commit(struct config *new, struct config *old) config_add_obstacle(old); rt_lock_table(tab); - if (tab->hostcache) - { - rt_stop_export(&tab->hostcache->req, NULL); - if (ev_get_list(&tab->hostcache->update) == &rt_cork.queue) - ev_postpone(&tab->hostcache->update); - } - rt_check_cork_low(tab); - rt_unlock_table(tab); + if (tab->hostcache && ev_get_list(&tab->hostcache->update) == &rt_cork.queue) + ev_postpone(&tab->hostcache->update); + + /* Force one more loop run */ + birdloop_flag(tab->loop, RTF_DELETE); RT_UNLOCK(tab); } } @@ -4583,7 +4588,7 @@ rt_init_hostcache(struct rtable_private *tab) hc->req = (struct rt_export_request) { .name = mb_sprintf(tab->rp, "%s.hcu.notifier", tab->name), - .list = &global_work_list, + .list = birdloop_event_list(tab->loop), .trace_routes = tab->config->debug, .dump_req = hc_notify_dump_req, .log_state_change = hc_notify_log_state_change, @@ -185,6 +185,7 @@ typedef union rtable { #define RTF_CLEANUP 1 #define RTF_NHU 2 #define RTF_EXPORT 4 +#define RTF_DELETE 8 extern struct rt_cork { _Atomic uint active; |