projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git://tinc-vpn.org/tinc into 1.1
[tinc]
/
src
/
graph.c
diff --git
a/src/graph.c
b/src/graph.c
index
42157b0
..
d432023
100644
(file)
--- a/
src/graph.c
+++ b/
src/graph.c
@@
-1,6
+1,6
@@
/*
graph.c -- graph algorithms
/*
graph.c -- graph algorithms
- Copyright (C) 2001-201
1
Guus Sliepen <guus@tinc-vpn.org>,
+ Copyright (C) 2001-201
2
Guus Sliepen <guus@tinc-vpn.org>,
2001-2005 Ivo Timmermans
This program is free software; you can redistribute it and/or modify
2001-2005 Ivo Timmermans
This program is free software; you can redistribute it and/or modify
@@
-65,7
+65,7
@@
Please note that sorting on weight is already done by add_edge().
*/
Please note that sorting on weight is already done by add_edge().
*/
-void mst_kruskal(void) {
+
static
void mst_kruskal(void) {
splay_node_t *node, *next;
edge_t *e;
node_t *n;
splay_node_t *node, *next;
edge_t *e;
node_t *n;
@@
-78,7
+78,7
@@
void mst_kruskal(void) {
c->status.mst = false;
}
c->status.mst = false;
}
-
ifdebug(SCARY_THINGS) logger(
LOG_DEBUG, "Running Kruskal's algorithm:");
+
logger(DEBUG_SCARY_THINGS,
LOG_DEBUG, "Running Kruskal's algorithm:");
/* Clear visited status on nodes */
/* Clear visited status on nodes */
@@
-105,7
+105,7
@@
void mst_kruskal(void) {
if(e->reverse->connection)
e->reverse->connection->status.mst = true;
if(e->reverse->connection)
e->reverse->connection->status.mst = true;
-
ifdebug(SCARY_THINGS) logger(
LOG_DEBUG, " Adding edge %s - %s weight %d", e->from->name,
+
logger(DEBUG_SCARY_THINGS,
LOG_DEBUG, " Adding edge %s - %s weight %d", e->from->name,
e->to->name, e->weight);
}
}
e->to->name, e->weight);
}
}
@@
-124,7
+124,7
@@
static void sssp_dijkstra(void) {
todo_list = list_alloc(NULL);
todo_list = list_alloc(NULL);
-
ifdebug(SCARY_THINGS) logger(
LOG_DEBUG, "Running Dijkstra's algorithm:");
+
logger(DEBUG_SCARY_THINGS,
LOG_DEBUG, "Running Dijkstra's algorithm:");
/* Clear visited status on nodes */
/* Clear visited status on nodes */
@@
-204,7
+204,7
@@
static void sssp_dijkstra(void) {
if(e->to->address.sa.sa_family == AF_UNSPEC && e->address.sa.sa_family != AF_UNKNOWN)
update_node_udp(e->to, &e->address);
if(e->to->address.sa.sa_family == AF_UNSPEC && e->address.sa.sa_family != AF_UNKNOWN)
update_node_udp(e->to, &e->address);
-
ifdebug(SCARY_THINGS) logger(
LOG_DEBUG, " Updating edge %s - %s weight %d distance %d", e->from->name,
+
logger(DEBUG_SCARY_THINGS,
LOG_DEBUG, " Updating edge %s - %s weight %d distance %d", e->from->name,
e->to->name, e->weight, e->to->distance);
}
}
e->to->name, e->weight, e->to->distance);
}
}
@@
-216,7
+216,7
@@
static void sssp_dijkstra(void) {
Running time: O(E)
*/
Running time: O(E)
*/
-void sssp_bfs(void) {
+
static
void sssp_bfs(void) {
splay_node_t *node, *to;
edge_t *e;
node_t *n;
splay_node_t *node, *to;
edge_t *e;
node_t *n;
@@
-315,10
+315,10
@@
static void check_reachability(void) {
n->status.reachable = !n->status.reachable;
if(n->status.reachable) {
n->status.reachable = !n->status.reachable;
if(n->status.reachable) {
-
ifdebug(TRAFFIC) logger(
LOG_DEBUG, "Node %s (%s) became reachable",
+
logger(DEBUG_TRAFFIC,
LOG_DEBUG, "Node %s (%s) became reachable",
n->name, n->hostname);
} else {
n->name, n->hostname);
} else {
-
ifdebug(TRAFFIC) logger(
LOG_DEBUG, "Node %s (%s) became unreachable",
+
logger(DEBUG_TRAFFIC,
LOG_DEBUG, "Node %s (%s) became unreachable",
n->name, n->hostname);
}
n->name, n->hostname);
}
@@
-369,7
+369,7
@@
static void check_reachability(void) {
void graph(void) {
subnet_cache_flush();
void graph(void) {
subnet_cache_flush();
- sssp_
dijkstra
();
+ sssp_
bfs
();
check_reachability();
mst_kruskal();
}
check_reachability();
mst_kruskal();
}