From: Guus Sliepen Date: Tue, 24 Nov 2015 15:48:44 +0000 (+0100) Subject: Don't leave dead outgoing_t's in the outgoing_list. X-Git-Tag: release-1.1pre12~80 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=9fdf4278f8c8c1563d45205c9e9f1bc351bd814f;p=tinc Don't leave dead outgoing_t's in the outgoing_list. If an outgoing connection cannot be made because no address is known for it, it should be removed from the outgoing_list, otherwise it will prevent it from being re-added later when we do know addresses for it. --- diff --git a/src/net_socket.c b/src/net_socket.c index 97d6c448..11b63202 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -604,9 +604,12 @@ void setup_outgoing_connection(outgoing_t *outgoing) { if(n && n->connection) { logger(DEBUG_CONNECTIONS, LOG_INFO, "Already connected to %s", outgoing->name); - - n->connection->outgoing = outgoing; - return; + if(!n->connection->outgoing) { + n->connection->outgoing = outgoing; + return; + } else { + goto remove; + } } init_configuration(&outgoing->config_tree); @@ -618,11 +621,16 @@ void setup_outgoing_connection(outgoing_t *outgoing) { outgoing->aip = outgoing->ai = get_known_addresses(n); if(!outgoing->ai) { logger(DEBUG_ALWAYS, LOG_DEBUG, "No address known for %s", outgoing->name); - return; + goto remove; } } do_outgoing_connection(outgoing); + return; + +remove: + list_delete(outgoing_list, outgoing); + free(outgoing); } /*