X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_socket.c;h=206321cd52425d9cfc4bfbc887d59310d5612dc6;hb=fd27c14b9353e7a6eef38860395383d4d1a0bec8;hp=a69612790852b2d7379ae8d781360c6722a852c6;hpb=d6b45d005530496e48325a6174ecdd889a17bfc1;p=tinc diff --git a/src/net_socket.c b/src/net_socket.c index a6961279..206321cd 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -527,7 +527,7 @@ bool do_outgoing_connection(outgoing_t *outgoing) { int result; begin: - sa = get_recent_address(outgoing->address_cache); + sa = get_recent_address(outgoing->node->address_cache); if(!sa) { logger(DEBUG_CONNECTIONS, LOG_ERR, "Could not set up a meta connection to %s", outgoing->node->name); @@ -632,6 +632,10 @@ void setup_outgoing_connection(outgoing_t *outgoing, bool verbose) { node_t *n = outgoing->node; + if(!n->address_cache) { + n->address_cache = open_address_cache(n); + } + if(n->connection) { logger(DEBUG_CONNECTIONS, LOG_INFO, "Already connected to %s", n->name); @@ -643,10 +647,6 @@ void setup_outgoing_connection(outgoing_t *outgoing, bool verbose) { } } - if(!outgoing->address_cache) { - outgoing->address_cache = open_address_cache(n); - } - do_outgoing_connection(outgoing); return; @@ -787,11 +787,6 @@ void handle_new_unix_connection(void *data, int flags) { static void free_outgoing(outgoing_t *outgoing) { timeout_del(&outgoing->ev); - - if(outgoing->address_cache) { - close_address_cache(outgoing->address_cache); - } - free(outgoing); }