MEDIUM: server: do not restrict anymore usage of IP address from the state file

Now that it is possible to decide whether we prefer to use libc or the
state file to resolve the server's IP address and it is possible to change
a server's IP address at run time on the CLI, let's not restrict the reuse
of the address from the state file anymore to the DNS only.

The impact is that by default the state file will be considered first
(which matches its purpose) and only then the libc. This way any address
change performed at run time over the CLI will be preserved regardless
of DNS usage or not.
This commit is contained in:
Willy Tarreau 2016-11-09 14:54:53 +01:00
parent 3eed10e54b
commit e5a60688a4
2 changed files with 7 additions and 7 deletions

View File

@ -4550,9 +4550,11 @@ load-server-state-from-file { global | local | none }
none don't load any stat for this backend
Notes:
- server's IP address is not updated unless DNS resolution is enabled on
the server. It means that if a server IP address has been changed using
the stat socket, this information won't be re-applied after reloading.
- server's IP address is preserved across reloads by default, but the
order can be changed thanks to the server's "init-addr" setting. This
means that an IP address change performed on the CLI at run time will
be preserved, and that any change to the local resolver (eg: /etc/hosts)
will possibly not have any effect if the state file is in use.
- server's weight is applied from previous running process unless it has
has changed between previous and new configuration files.

View File

@ -2333,10 +2333,8 @@ static void srv_update_state(struct server *srv, int version, char **params)
}
server_recalc_eweight(srv);
/* load server IP only if DNS resolution is used on the server */
if (srv->resolution) {
srv->lastaddr = strdup(params[0]);
}
/* load server IP address */
srv->lastaddr = strdup(params[0]);
break;
default:
chunk_appendf(msg, ", version '%d' not supported", version);