Better interaction between reverse-DNS resolution and reconnection.

This commit is contained in:
LemonBoy 2016-06-30 13:30:49 +02:00
commit 32cdc6abdf
3 changed files with 6 additions and 1 deletions

View file

@ -36,6 +36,7 @@ unsigned int server_operator:1;
unsigned int usermode_away:1;
unsigned int banned:1; /* not allowed to connect to this server */
unsigned int dns_error:1; /* DNS said the host doesn't exist */
unsigned int dns_reverse:1;
GTimeVal lag_sent; /* 0 or time when last lag query was sent to server */
time_t lag_last_check; /* last time we checked lag */

View file

@ -248,7 +248,10 @@ static void sig_reconnect(SERVER_REC *server)
sserver->dns_error = server->dns_error;
}
if (sserver == NULL || conn->chatnet == NULL) {
/* server_setup_fill fails if we've reverse-resolved the connrec
* address, so let's pick another server from the chatnet if possible. */
if ((sserver == NULL && server->dns_reverse == FALSE) ||
conn->chatnet == NULL) {
/* not in any chatnet, just reconnect back to same server */
conn->family = server->connrec->family;
conn->address = g_strdup(server->connrec->address);

View file

@ -311,6 +311,7 @@ static void server_connect_callback_readpipe(SERVER_REC *server)
if (servername) {
g_free(server->connrec->address);
server->connrec->address = g_strdup(servername);
server->dns_reverse = TRUE;
}
server_real_connect(server, ip, NULL);
errormsg = NULL;