terminate_connection(): only kill c->node->connection if it is pointing
[tinc] / src / net.c
index db5743a..58db16e 100644 (file)
--- 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 */