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);
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);
}
}
- if(!outgoing->address_cache) {
- outgoing->address_cache = open_address_cache(n);
- }
-
do_outgoing_connection(outgoing);
return;
static void free_outgoing(outgoing_t *outgoing) {
timeout_del(&outgoing->ev);
-
- if(outgoing->address_cache) {
- close_address_cache(outgoing->address_cache);
- }
-
free(outgoing);
}
/* Successful connection, reset timeout if this is an outgoing connection. */
- if(c->outgoing) {
+ if(c->outgoing && c->outgoing->timeout) {
c->outgoing->timeout = 0;
- reset_address_cache(c->outgoing->address_cache, &c->address);
+ reset_address_cache(c->outgoing->node->address_cache, &c->address);
}
return true;