BUG/MINOR: resolvers: Unlink DNS resolution to set RMAINT on SRV resolution
When a server is set in RMAINT becaues of a SRV resolution failure, the
server DNS resolution, if any, must be unlink first. It is mandatory to
handle the change in the context of a SRV resolution.
This patch must be backported as far as 2.2.
(cherry picked from commit bca680ba90787fc57b9711e268f6fb0c74e7e49c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/server.c b/src/server.c
index a90e568..dd82d9b 100644
--- a/src/server.c
+++ b/src/server.c
@@ -3963,6 +3963,7 @@
for (s = srvrq->proxy->srv; s != NULL; s = s->next) {
HA_SPIN_LOCK(SERVER_LOCK, &s->lock);
if (s->srvrq == srvrq) {
+ dns_unlink_resolution(s->dns_requester);
snr_update_srv_status(s, 1);
free(s->hostname);
free(s->hostname_dn);
@@ -3971,7 +3972,6 @@
s->hostname_dn_len = 0;
memset(&s->addr, 0, sizeof(s->addr));
s->svc_port = 0;
- dns_unlink_resolution(s->dns_requester);
}
HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);
}