Commit 8a65b607 authored by Maria Matejka's avatar Maria Matejka
Browse files

Nest: Fixed not-optimized tail-recursion.

parent 14e7eb6d
Loading
Loading
Loading
Loading
+30 −30
Original line number Diff line number Diff line
@@ -1699,10 +1699,10 @@ rte_update2(struct channel *c, const net_addr *n, rte *new, struct rte_src *src)
  rte_dispatch_update(&rud);
}

static int
static _Bool
rte_finish_update(struct rte_update_data *rud)
{
  int out = 0;
  _Bool out = 0;

  domain_assert_write_locked(rud->channel->table->domain);

@@ -1780,6 +1780,9 @@ rte_finish_update_hook(struct task *task)
  debug("FUH: %d\n");

  struct rte_update_data *rud = SKIP_BACK(struct rte_update_data, task, task);

  for (_Bool fast = 1; fast; )
  {
    struct channel *c = rud->channel;
    struct rtable *rt = c->table;

@@ -1790,7 +1793,7 @@ rte_finish_update_hook(struct task *task)
    ASSERT(REM_HEAD_LOCKED(&(c->pending_imports)) == rud);

    /* Do the real table update */
  int fast = rte_finish_update(rud);
    fast = rte_finish_update(rud);

    /* Look for the next node */
    rud = NULL;
@@ -1812,10 +1815,7 @@ rte_finish_update_hook(struct task *task)

    if (!rud)
      return;

  /* Merge fast route updates */
  if (fast)
    return rte_finish_update_hook(&(rud->task));
  }

  task_init(&(rud->task), TF_EXCLUSIVE | TF_TAIL, rud->channel->table->domain, rte_finish_update_hook);
  task_push(&(rud->task));