X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet_socket.c;fp=src%2Fnet_socket.c;h=982bc800a1ebf88860bce270a61ac562aaeec32c;hp=4c76c30a579c6976138f28cdfd67233a4fdf92c7;hb=c6a15e27d934e90a1f3a26438dddb395bdc9de19;hpb=1695d8828ed6fb997dbd96e21c105ab5641b90c5 diff --git a/src/net_socket.c b/src/net_socket.c index 4c76c30a..982bc800 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -671,22 +671,18 @@ void setup_outgoing_connection(outgoing_t *outgoing, bool verbose) { n->address_cache = open_address_cache(n); } - 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; - } + if(!n->connection) { + do_outgoing_connection(outgoing); + return; } - do_outgoing_connection(outgoing); - return; + logger(DEBUG_CONNECTIONS, LOG_INFO, "Already connected to %s", n->name); -remove: - list_delete(&outgoing_list, outgoing); + if(n->connection->outgoing) { + list_delete(&outgoing_list, outgoing); + } else { + n->connection->outgoing = outgoing; + } } static bool check_tarpit(const sockaddr_t *sa, int fd) { @@ -864,8 +860,7 @@ 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); }