diff options
author | Paul Jakma <paul@quagga.net> | 2011-03-20 22:08:02 +0000 |
---|---|---|
committer | Paul Jakma <paul@quagga.net> | 2011-03-20 22:09:15 +0000 |
commit | d1de1c25962b5470f3825bc82d15e4dd29e1f842 (patch) | |
tree | 9e9b3c6ed51a0fdc78e0eb8900fad8f7e7598b98 /ospf6d/ospf6_spf.c | |
parent | 4dd87df5af8a59174362e44f83df11f12457c8b4 (diff) | |
parent | e6844aa5d23cf56dd1f31afc96e8145ab188953f (diff) |
Merge paul/ospfd/201012-review ospfd and lib/ fixes and performance improvements
Diffstat (limited to 'ospf6d/ospf6_spf.c')
-rw-r--r-- | ospf6d/ospf6_spf.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index bfb6df2e..04367f08 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -50,7 +50,9 @@ ospf6_vertex_cmp (void *a, void *b) struct ospf6_vertex *vb = (struct ospf6_vertex *) b; /* ascending order */ - return (va->cost - vb->cost); + if (va->cost != vb->cost) + return (va->cost - vb->cost); + return (va->hops - vb->hops); } static int @@ -320,22 +322,8 @@ ospf6_spf_install (struct ospf6_vertex *v, } prev = (struct ospf6_vertex *) route->route_option; - if (prev->hops > v->hops) - { - for (ALL_LIST_ELEMENTS (prev->child_list, node, nnode, w)) - { - assert (w->parent == prev); - w->parent = v; - listnode_add_sort (v->child_list, w); - } - listnode_delete (prev->parent->child_list, prev); - listnode_add_sort (v->parent->child_list, v); - - ospf6_vertex_delete (prev); - route->route_option = v; - } - else - ospf6_vertex_delete (v); + assert (prev->hops <= v->hops); + ospf6_vertex_delete (v); return -1; } |