- logger(DEBUG_CONNECTIONS, LOG_INFO, _("Trying to connect to %s (%s)"), c->name,
- c->hostname);
+ if(!get_next_outgoing_address(mesh, outgoing)) {
+ if(outgoing->state == OUTGOING_CANONICAL_RESOLVE) {
+ /* We are waiting for a callback from the ADNS thread */
+ } else if(outgoing->state == OUTGOING_NO_KNOWN_ADDRESSES) {
+ logger(mesh, MESHLINK_ERROR, "No known addresses for %s", outgoing->node->name);
+ } else {
+ logger(mesh, MESHLINK_ERROR, "Could not set up a meta connection to %s", outgoing->node->name);
+ retry_outgoing(mesh, outgoing);
+ }
+
+ return;
+ }
+
+ connection_t *c = new_connection();
+ c->outgoing = outgoing;
+
+ memcpy(&c->address, outgoing->aip->ai_addr, outgoing->aip->ai_addrlen);
+
+ if(mesh->log_level <= MESHLINK_INFO) {
+ char *hostname = sockaddr2hostname(&c->address);
+ logger(mesh, MESHLINK_INFO, "Trying to connect to %s at %s", outgoing->node->name, hostname);
+ free(hostname);
+ }