projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace the connection_tree with a connection_list.
[tinc]
/
src
/
graph.c
diff --git
a/src/graph.c
b/src/graph.c
index
506b6df
..
3cc99c6
100644
(file)
--- a/
src/graph.c
+++ b/
src/graph.c
@@
-44,12
+44,12
@@
#include "system.h"
#include "system.h"
-#include "splay_tree.h"
#include "config.h"
#include "connection.h"
#include "device.h"
#include "edge.h"
#include "graph.h"
#include "config.h"
#include "connection.h"
#include "device.h"
#include "edge.h"
#include "graph.h"
+#include "list.h"
#include "logger.h"
#include "netutl.h"
#include "node.h"
#include "logger.h"
#include "netutl.h"
#include "node.h"
@@
-66,15
+66,10
@@
*/
static void mst_kruskal(void) {
*/
static void mst_kruskal(void) {
- splay_node_t *node, *next;
- edge_t *e;
- node_t *n;
- connection_t *c;
-
/* Clear MST status on connections */
/* Clear MST status on connections */
- for(
node = connection_tree
->head; node; node = node->next) {
- c = node->data;
+ for(
list_node_t *node = connection_list
->head; node; node = node->next) {
+ c
onnection_t *c
= node->data;
c->status.mst = false;
}
c->status.mst = false;
}
@@
-82,16
+77,16
@@
static void mst_kruskal(void) {
/* Clear visited status on nodes */
/* Clear visited status on nodes */
- for(node = node_tree->head; node; node = node->next) {
- n = node->data;
+ for(
splay_node_t *
node = node_tree->head; node; node = node->next) {
+ n
ode_t *n
= node->data;
n->status.visited = false;
}
/* Add safe edges */
n->status.visited = false;
}
/* Add safe edges */
- for(
node = edge_weight_tree->head
; node; node = next) {
+ for(
splay_node_t *node = edge_weight_tree->head, *next
; node; node = next) {
next = node->next;
next = node->next;
- e = node->data;
+ e
dge_t *e
= node->data;
if(!e->reverse || (e->from->status.visited && e->to->status.visited))
continue;
if(!e->reverse || (e->from->status.visited && e->to->status.visited))
continue;
@@
-188,7
+183,8
@@
static void sssp_bfs(void) {
e->to->options = e->options;
e->to->distance = n->distance + 1;
e->to->options = e->options;
e->to->distance = n->distance + 1;
- if(e->to->address.sa.sa_family == AF_UNSPEC && e->address.sa.sa_family != AF_UNKNOWN)
+ if(!e->to->status.reachable || (e->to->address.sa.sa_family == AF_UNSPEC && e->address.sa.sa_family != AF_UNKNOWN)
+)
update_node_udp(e->to, &e->address);
list_insert_tail(todo_list, e->to);
update_node_udp(e->to, &e->address);
list_insert_tail(todo_list, e->to);
@@
-217,6
+213,7
@@
static void check_reachability(void) {
if(n->status.visited != n->status.reachable) {
n->status.reachable = !n->status.reachable;
if(n->status.visited != n->status.reachable) {
n->status.reachable = !n->status.reachable;
+ n->last_state_change = time(NULL);
if(n->status.reachable) {
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Node %s (%s) became reachable",
if(n->status.reachable) {
logger(DEBUG_TRAFFIC, LOG_DEBUG, "Node %s (%s) became reachable",
@@
-226,9
+223,16
@@
static void check_reachability(void) {
n->name, n->hostname);
}
n->name, n->hostname);
}
+ if(experimental && OPTION_VERSION(n->options) >= 2)
+ n->status.sptps = true;
+
/* TODO: only clear status.validkey if node is unreachable? */
n->status.validkey = false;
/* TODO: only clear status.validkey if node is unreachable? */
n->status.validkey = false;
+ if(n->status.sptps) {
+ sptps_stop(&n->sptps);
+ n->status.waitingforkey = false;
+ }
n->last_req_key = 0;
n->maxmtu = MTU;
n->last_req_key = 0;
n->maxmtu = MTU;
@@
-266,7
+270,7
@@
static void check_reachability(void) {
if(!n->status.reachable) {
update_node_udp(n, NULL);
} else if(n->connection) {
if(!n->status.reachable) {
update_node_udp(n, NULL);
} else if(n->connection) {
- if(
experimental && OPTION_VERSION(n->options) >= 2
) {
+ if(
n->status.sptps
) {
if(n->connection->outgoing)
send_req_key(n);
} else {
if(n->connection->outgoing)
send_req_key(n);
} else {