X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet.c;h=863dd762c326c885312a88d703f157f2ae4fc0ed;hb=268c8545aaf83b7433f43402f5c77e39e20006ef;hp=2565be113506502626af2c65ff49c7cb8cf7b61c;hpb=a96c4f016c9fff2392d85f762e16f5430c0b6463;p=tinc diff --git a/src/net.c b/src/net.c index 2565be11..863dd762 100644 --- a/src/net.c +++ b/src/net.c @@ -113,7 +113,7 @@ void terminate_connection(connection_t *c, bool report) { c->status.active = false; - if(c->node) + if(c->node && c->node->connection == c) c->node->connection = NULL; if(c->edge) { @@ -145,8 +145,10 @@ void terminate_connection(connection_t *c, bool report) { /* Check if this was our outgoing connection */ if(c->outgoing) { - do_outgoing_connection(c); - } + do_outgoing_connection(c); + } else { + connection_del(c); + } } /* @@ -339,9 +341,10 @@ int reload_configuration(void) { void retry(void) { connection_t *c; - splay_node_t *node; + splay_node_t *node, *next; - for(node = connection_tree->head; node; node = node->next) { + for(node = connection_tree->head; node; node = next) { + next = node->next; c = node->data; if(c->outgoing && !c->node) {