Use a global list to track outgoing connections.
[tinc] / src / net_setup.c
index f52afb0..c413792 100644 (file)
@@ -571,18 +571,12 @@ void close_network_connections(void)
        for(node = connection_tree->head; node; node = next) {
                next = node->next;
                c = node->data;
-
-               if(c->outgoing) {
-                       if(c->outgoing->ai)
-                               freeaddrinfo(c->outgoing->ai);
-                       free(c->outgoing->name);
-                       free(c->outgoing);
-                       c->outgoing = NULL;
-               }
-
+               c->outgoing = false;
                terminate_connection(c, false);
        }
 
+       list_delete_list(outgoing_list);
+
        if(myself && myself->connection) {
                subnet_update(myself, NULL, false);
                terminate_connection(myself->connection, false);