X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fgraph.c;h=c100a933a6a1abbcde7e53b8ec9bf759caf1a996;hb=72091d5c770856870bb8cd51bcc5641078c7562c;hp=da6490911e36b3853f24f84cc345c4278c7c3bb0;hpb=d7408492415b8c6eb50de44d2dd74b93b0b3e902;p=tinc diff --git a/src/graph.c b/src/graph.c index da649091..c100a933 100644 --- a/src/graph.c +++ b/src/graph.c @@ -115,11 +115,13 @@ static void mst_kruskal(void) { } } +// Not putting it into header, the outside world doesn't need to know about it. +extern void sssp_bfs(void); + /* Implementation of a simple breadth-first search algorithm. Running time: O(E) */ - -static void sssp_bfs(void) { +void sssp_bfs(void) { list_t *todo_list = list_alloc(NULL); /* Clear visited status on nodes */ @@ -181,7 +183,7 @@ static void sssp_bfs(void) { // Only update nexthop if it doesn't increase the path length - if(!e->to->status.visited || (e->to->distance == n->distance + 1 && e->weight >= e->to->prevedge->weight)) { + if(!e->to->status.visited || (e->to->distance == n->distance + 1 && e->weight < e->to->prevedge->weight)) { e->to->nexthop = (n->nexthop == myself) ? e->to : n->nexthop; }