X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet.c;h=295546df6068a5e63e2c4701d2d5c56d94f4a650;hb=58007d7efa3940c863c5a398f8b257a686ce37ba;hp=db5743af2e9179915aca7686ac5c7fa497050746;hpb=86c2990327fdf7ec1197aa73cb2b9a926a734db4;p=tinc diff --git a/src/net.c b/src/net.c index db5743af..295546df 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); + } } /*