Don't forget about outgoing connections on host file read errors.
authorGuus Sliepen <guus@tinc-vpn.org>
Tue, 27 Jun 2017 21:36:52 +0000 (23:36 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Tue, 27 Jun 2017 21:36:52 +0000 (23:36 +0200)
If the host config file for an outgoing connection cannot be read, or if
it doesn't contain any Address, don't forget about the ConnectTo, but go
straight to MaxTimeout seconds for retries.

src/net_socket.c

index 80ae677..284bab7 100644 (file)
@@ -1,7 +1,7 @@
 /*
     net_socket.c -- Handle various kinds of sockets.
     Copyright (C) 1998-2005 Ivo Timmermans,
 /*
     net_socket.c -- Handle various kinds of sockets.
     Copyright (C) 1998-2005 Ivo Timmermans,
-                  2000-2015 Guus Sliepen <guus@tinc-vpn.org>
+                  2000-2017 Guus Sliepen <guus@tinc-vpn.org>
                   2006      Scott Lamb <slamb@slamb.org>
                   2009      Florian Forster <octo@verplant.org>
 
                   2006      Scott Lamb <slamb@slamb.org>
                   2009      Florian Forster <octo@verplant.org>
 
@@ -556,13 +556,20 @@ void setup_outgoing_connection(outgoing_t *outgoing) {
        c->outcompression = myself->connection->outcompression;
 
        init_configuration(&c->config_tree);
        c->outcompression = myself->connection->outcompression;
 
        init_configuration(&c->config_tree);
-       read_connection_config(c);
+       if(!read_connection_config(c)) {
+               free_connection(c);
+               outgoing->timeout = maxtimeout;
+               retry_outgoing(outgoing);
+               return;
+       }
 
        outgoing->cfg = lookup_config(c->config_tree, "Address");
 
        if(!outgoing->cfg) {
                logger(LOG_ERR, "No address specified for %s", c->name);
                free_connection(c);
 
        outgoing->cfg = lookup_config(c->config_tree, "Address");
 
        if(!outgoing->cfg) {
                logger(LOG_ERR, "No address specified for %s", c->name);
                free_connection(c);
+               outgoing->timeout = maxtimeout;
+               retry_outgoing(outgoing);
                return;
        }
 
                return;
        }