]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: server: simplify snr_set_srv_down() to prevent confusions
authorAurelien DARRAGON <adarragon@haproxy.com>
Fri, 22 Dec 2023 13:17:41 +0000 (14:17 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 2 Jan 2024 09:29:50 +0000 (10:29 +0100)
commitbdecff511cde4621b5fe0bcbf2e6245000492b74
tree2ba48dda34886ed49f9034769e94630bf58c1a26
parent689784ed91b8af39c9efd32627efe424e7ee6da9
MEDIUM: server: simplify snr_set_srv_down() to prevent confusions

snr_set_srv_down() (was formely known as snr_update_srv_status()), is
still too ambiguous because it's not clear whether we will be putting
the server under maintenance or not. This is mainly due to the fact that
the function behaves differently if has_no_ip is set or not.

By reviewing the function callers, it has now become clear that
snr_resolution_cb() is always calling the function with a valid resolution
so we only want to put the server under maintenance if we don't have a
valid IP address. On the other hand snr_resolution_error_cb() always
calls the function on error, with either no resolution (for SRV requests)
or with failing resolution (all cases except RSLV_STATUS_VALID), so in
this case we decide whether to put the server under maintenance case by
case (ie: expired? timeout?)

As a result, let's simplify snr_set_srv_down() so that it is only called
when the caller really thinks that the server should be put under
maintenance, which means always for snr_resolution_error_cb(), and only
if the resolution didn't yield usable ip for snr_resolution_cb().
src/server.c