degesch: better name resolution failure messages

This commit is contained in:
Přemysl Eric Janouch 2015-08-06 23:46:58 +02:00
parent 4ab247ead0
commit 2afc9f99c3
1 changed files with 16 additions and 2 deletions

View File

@ -4488,12 +4488,26 @@ irc_setup_connector (struct server *s,
connector->on_connected = irc_on_connector_connected;
connector->on_failure = irc_on_connector_failure;
bool at_least_one_address_succeeded = false;
for (size_t i = 0; i < addresses->len; i++)
{
char *host, *port;
irc_split_host_port (addresses->vector[i], &host, &port);
if (!connector_add_target (connector, host, port, e))
struct error *error = NULL;
if (connector_add_target (connector, host, port, &error))
at_least_one_address_succeeded = true;
else
{
log_server_error (s, s->buffer,
"Address resolution failed for #&s: #s",
format_host_port_pair (host, port), error->message);
error_free (error);
}
}
if (!at_least_one_address_succeeded)
{
error_set (e, "No address to connect to");
return false;
}