]> git.meshlink.io Git - meshlink/blobdiff - src/net.c
Don't close control connections when handling a reload command.
[meshlink] / src / net.c
index f9020b3b9aa8d4ab771167fa3cb5760ebe6f4211..c743d5981c7ce241189815a508ee05dd0be35cae 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -64,7 +64,7 @@ void purge(void) {
                        for(snode = n->subnet_tree->head; snode; snode = snext) {
                                snext = snode->next;
                                s = snode->data;
-                               send_del_subnet(broadcast, s);
+                               send_del_subnet(everyone, s);
                                if(!strictsubnets)
                                        subnet_del(n, s);
                        }
@@ -73,7 +73,7 @@ void purge(void) {
                                enext = enode->next;
                                e = enode->data;
                                if(!tunnelserver)
-                                       send_del_edge(broadcast, e);
+                                       send_del_edge(everyone, e);
                                edge_del(e);
                        }
                }
@@ -119,7 +119,7 @@ void terminate_connection(connection_t *c, bool report) {
 
        if(c->edge) {
                if(report && !tunnelserver)
-                       send_del_edge(broadcast, c->edge);
+                       send_del_edge(everyone, c->edge);
 
                edge_del(c->edge);
 
@@ -134,7 +134,7 @@ void terminate_connection(connection_t *c, bool report) {
                        e = lookup_edge(c->node, myself);
                        if(e) {
                                if(!tunnelserver)
-                                       send_del_edge(broadcast, e);
+                                       send_del_edge(everyone, e);
                                edge_del(e);
                        }
                }
@@ -165,6 +165,9 @@ static void timeout_handler(int fd, short events, void *event) {
                next = node->next;
                c = node->data;
 
+               if(c->status.control)
+                       continue;
+
                if(c->last_ping_time + pingtimeout <= now) {
                        if(c->status.active) {
                                if(c->status.pinged) {
@@ -276,6 +279,9 @@ int reload_configuration(void) {
        for(node = connection_tree->head; node; node = next) {
                c = node->data;
                next = node->next;
+
+               if(c->status.control)
+                       continue;
                
                if(c->outgoing) {
                        free(c->outgoing->name);
@@ -310,14 +316,14 @@ int reload_configuration(void) {
                        next = node->next;
                        subnet = node->data;
                        if(subnet->expires == 1) {
-                               send_del_subnet(broadcast, subnet);
+                               send_del_subnet(everyone, subnet);
                                if(subnet->owner->status.reachable)
                                        subnet_update(subnet->owner, subnet, false);
                                subnet_del(subnet->owner, subnet);
                        } else if(subnet->expires == -1) {
                                subnet->expires = 0;
                        } else {
-                               send_add_subnet(broadcast, subnet);
+                               send_add_subnet(everyone, subnet);
                                if(subnet->owner->status.reachable)
                                        subnet_update(subnet->owner, subnet, true);
                        }