X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fautoconnect.c;h=4279cd37e1acd769a6284e218af6fce2fa1bb5fa;hb=8c8dfd6686a3d4cc11c20a09c8dfbc8321b07cdb;hp=5651f54d1a4d3aa396d33be4f5b8c1c13a109dc6;hpb=0871c3095151bce6a4031a2662aa51b7193b855c;p=tinc diff --git a/src/autoconnect.c b/src/autoconnect.c index 5651f54d..4279cd37 100644 --- a/src/autoconnect.c +++ b/src/autoconnect.c @@ -28,7 +28,7 @@ static void make_new_connection() { /* Select a random node we haven't connected to yet. */ int count = 0; - for splay_each(node_t, n, node_tree) { + for splay_each(node_t, n, &node_tree) { if(n == myself || n->connection || !(n->status.has_address || n->status.reachable)) { continue; } @@ -42,7 +42,7 @@ static void make_new_connection() { int r = rand() % count; - for splay_each(node_t, n, node_tree) { + for splay_each(node_t, n, &node_tree) { if(n == myself || n->connection || !(n->status.has_address || n->status.reachable)) { continue; } @@ -80,9 +80,9 @@ static void connect_to_unreachable() { * are only a few reachable nodes, and many unreachable ones, we're * going to try harder to connect to them. */ - unsigned int r = rand() % node_tree->count; + unsigned int r = rand() % node_tree.count; - for splay_each(node_t, n, node_tree) { + for splay_each(node_t, n, &node_tree) { if(r--) { continue; } @@ -114,7 +114,7 @@ static void drop_superfluous_outgoing_connection() { int count = 0; for list_each(connection_t, c, &connection_list) { - if(!c->edge || !c->outgoing || !c->node || c->node->edge_tree->count < 2) { + if(!c->edge || !c->outgoing || !c->node || c->node->edge_tree.count < 2) { continue; } @@ -128,7 +128,7 @@ static void drop_superfluous_outgoing_connection() { int r = rand() % count; for list_each(connection_t, c, &connection_list) { - if(!c->edge || !c->outgoing || !c->node || c->node->edge_tree->count < 2) { + if(!c->edge || !c->outgoing || !c->node || c->node->edge_tree.count < 2) { continue; }