X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet.c;h=863dd762c326c885312a88d703f157f2ae4fc0ed;hb=c52c46f8717aac6904f32766d774fa3fdf9611d8;hp=db5743af2e9179915aca7686ac5c7fa497050746;hpb=1d9dacb1f26971e19463b5501c2410c57f780ecb;p=tinc diff --git a/src/net.c b/src/net.c index db5743af..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) { @@ -121,6 +121,7 @@ void terminate_connection(connection_t *c, bool report) { send_del_edge(everyone, c->edge); edge_del(c->edge); + c->edge = NULL; /* Run MST and SSSP algorithms */ @@ -144,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); + } } /* @@ -338,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) {