X-Git-Url: http://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_socket.c;h=c8aa78824d51b8536c975291d9b99b4e9daf311b;hb=4f48176209832913975843b6cf3bf1753152da3f;hp=92dcbedb929de0ea3b522961acc2691ae298f6b3;hpb=ce4d55b72fd4290d4710f10e755f6dd9ed039d88;p=tinc diff --git a/src/net_socket.c b/src/net_socket.c index 92dcbedb..c8aa7882 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -673,20 +673,9 @@ void setup_outgoing_connection(outgoing_t *outgoing, bool verbose) { if(n->connection) { logger(DEBUG_CONNECTIONS, LOG_INFO, "Already connected to %s", n->name); - - if(!n->connection->outgoing) { - n->connection->outgoing = outgoing; - return; - } else { - goto remove; - } + } else { + do_outgoing_connection(outgoing); } - - do_outgoing_connection(outgoing); - return; - -remove: - list_delete(&outgoing_list, outgoing); } static bool check_tarpit(const sockaddr_t *sa, int fd) { @@ -864,17 +853,16 @@ void try_outgoing_connections(void) { node_t *n = lookup_node(name); if(!n) { - n = new_node(); - n->name = xstrdup(name); + n = new_node(name); node_add(n); } - free(name); - outgoing->node = n; list_insert_tail(&outgoing_list, outgoing); setup_outgoing_connection(outgoing, true); } + + free(name); } /* Terminate any connections whose outgoing_t is to be deleted. */