When terminating, keep control connections open until the end.
[tinc] / src / net_setup.c
index 1c9a952..f07bdda 100644 (file)
@@ -586,7 +586,7 @@ static bool setup_myself(void) {
        free(fname);
 
        if(!get_config_string(lookup_config(config_tree, "Port"), &myport))
-               abort(); //myport = xstrdup("655");
+               myport = xstrdup("655");
 
        xasprintf(&myself->hostname, "MYSELF port %s", myport);
        myself->connection->hostname = xstrdup(myself->hostname);
@@ -963,6 +963,9 @@ void close_network_connections(void) {
        for(node = connection_tree->head; node; node = next) {
                next = node->next;
                c = node->data;
+               /* Keep control connections open until the end, so they know when we really terminated */
+               if(c->status.control)
+                       c->socket = -1;
                c->outgoing = NULL;
                terminate_connection(c, false);
        }