diff options
-rw-r--r-- | nest/rt-table.c | 33 | ||||
-rw-r--r-- | nest/rt.h | 3 |
2 files changed, 36 insertions, 0 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c index c1f3098b..15dbc371 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -2392,6 +2392,22 @@ rt_event(void *ptr) if (tab->export_used) rt_export_cleanup(tab); + if ( + tab->hcu_corked || + tab->nhu_corked || + (tab->hcu_scheduled || tab->nhu_state) && rt_cork_check(tab->uncork_event) + ) + { + if (!tab->hcu_corked && !tab->nhu_corked && config->table_debug) + log(L_TRACE "%s: Auxiliary routines corked", tab->name); + + tab->hcu_corked |= tab->hcu_scheduled; + tab->hcu_scheduled = 0; + + tab->nhu_corked |= tab->nhu_state; + tab->nhu_state = 0; + } + if (tab->hcu_scheduled) rt_update_hostcache(tab); @@ -2404,6 +2420,22 @@ rt_event(void *ptr) rt_unlock_table(tab); } +static void +rt_uncork_event(void *ptr) +{ + rtable *tab = ptr; + + tab->hcu_scheduled |= tab->hcu_corked; + tab->hcu_corked = 0; + + tab->nhu_state |= tab->nhu_corked; + tab->nhu_corked = 0; + + if (config->table_debug) + log(L_TRACE "%s: Auxiliary routines uncorked", tab->name); + + ev_schedule(tab->rt_event); +} static void rt_prune_timer(timer *t) @@ -2669,6 +2701,7 @@ rt_setup(pool *pp, struct rtable_config *cf) init_list(&t->subscribers); t->rt_event = ev_new_init(p, rt_event, t); + t->uncork_event = ev_new_init(p, rt_uncork_event, t); t->prune_timer = tm_new_init(p, rt_prune_timer, t, 0, 0); t->exporter.export_timer = tm_new_init(p, rt_announce_exports, t, 0, 0); t->last_rt_change = t->gc_time = current_time(); @@ -107,6 +107,7 @@ typedef struct rtable { * obstacle from this routing table. */ struct event *rt_event; /* Routing table event */ + struct event *uncork_event; /* Called when uncork happens */ struct timer *prune_timer; /* Timer for periodic pruning / GC */ btime last_rt_change; /* Last time when route changed */ btime base_settle_time; /* Start time of rtable settling interval */ @@ -115,7 +116,9 @@ typedef struct rtable { byte prune_state; /* Table prune state, 1 -> scheduled, 2-> running */ byte prune_trie; /* Prune prefix trie during next table prune */ byte hcu_scheduled; /* Hostcache update is scheduled */ + byte hcu_corked; /* Hostcache update is corked with this state */ byte nhu_state; /* Next Hop Update state */ + byte nhu_corked; /* Next Hop Update is corked with this state */ byte export_used; /* Pending Export pruning is scheduled */ byte cork_active; /* Cork has been activated */ struct rt_cork_threshold cork_threshold; /* Threshold for table cork */ |