Don't close control connections when handling a reload command.
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 26 Feb 2012 15:56:53 +0000 (16:56 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 26 Feb 2012 15:56:53 +0000 (16:56 +0100)
Because this would terminate the connection while the control message
handler was still running, it would lead to a segmentation fault later
on.

src/net.c

index 336bf9e..c743d59 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -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);