MINOR: resolvers: Directly call srvrq_update_srv_state() when possible
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 11 Mar 2021 17:06:23 +0000 (18:06 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 16 Mar 2021 08:38:57 +0000 (09:38 +0100)
When the server status must be updated from the result of a SRV resolution,
we can directly call srvrq_update_srv_state(). It is simpler and this avoid
a test on the server DNS resolution.

This patch is mandatory for the next commit. It also rely on "MINOR:
resolvers: Directly call srvrq_update_srv_state() when possible".

(cherry picked from commit 6b117aed492d9916a5c656b4fbfcac6159133c0f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>

src/dns.c
src/server.c

index ee1796b..5e94254 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -653,7 +653,7 @@ static void dns_check_dns_response(struct dns_resolution *res)
                                            item->data_len == srv->hostname_dn_len &&
                                            !dns_hostname_cmp(srv->hostname_dn, item->target, item->data_len)) {
                                                dns_unlink_resolution(srv->dns_requester);
-                                               snr_update_srv_status(srv, 1);
+                                               srvrq_update_srv_status(srv, 1);
                                                free(srv->hostname);
                                                free(srv->hostname_dn);
                                                srv->hostname        = NULL;
@@ -759,7 +759,7 @@ static void dns_check_dns_response(struct dns_resolution *res)
                                }
 
                                /* Update the server status */
-                               snr_update_srv_status(srv, (srv->addr.ss_family != AF_INET && srv->addr.ss_family != AF_INET6));
+                               srvrq_update_srv_status(srv, (srv->addr.ss_family != AF_INET && srv->addr.ss_family != AF_INET6));
 
                                srv->svc_port = item->port;
                                srv->flags   &= ~SRV_F_MAPPORTS;
index 8314f78..c687296 100644 (file)
@@ -3997,7 +3997,7 @@ int srvrq_resolution_error_cb(struct dns_requester *requester, int error_code)
                HA_SPIN_LOCK(SERVER_LOCK, &s->lock);
                if (s->srvrq == srvrq) {
                        dns_unlink_resolution(s->dns_requester);
-                       snr_update_srv_status(s, 1);
+                       srvrq_update_srv_status(s, 1);
                        free(s->hostname);
                        free(s->hostname_dn);
                        s->hostname        = NULL;