X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_socket.c;h=11b632026d89ac38d54ec2cf1b94ab64ce314a1a;hb=9fdf4278f8c8c1563d45205c9e9f1bc351bd814f;hp=526d382a41d37d24ae8a718e95c21fbebd52fc9c;hpb=3e61c7233b087b8400c29ca7a8d079aad8b706d8;p=tinc diff --git a/src/net_socket.c b/src/net_socket.c index 526d382a..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); @@ -617,12 +620,17 @@ void setup_outgoing_connection(outgoing_t *outgoing) { if(n) outgoing->aip = outgoing->ai = get_known_addresses(n); if(!outgoing->ai) { - logger(DEBUG_ALWAYS, LOG_ERR, "No address known for %s", outgoing->name); - return; + logger(DEBUG_ALWAYS, LOG_DEBUG, "No address known for %s", outgoing->name); + goto remove; } } do_outgoing_connection(outgoing); + return; + +remove: + list_delete(outgoing_list, outgoing); + free(outgoing); } /*