MINOR: dns: move callback affection in dns_link_resolution()

In dns.c, dns_link_resolution(), each type of dns requester is managed
separately, that said, the callback function is affected globaly (and
points to server type callbacks only).
This design prevents the addition of new dns requester type and this
patch aims at fixing this limitation: now, the callback setting is done
directly into the portion of code dedicated to each requester type.
This commit is contained in:
Baptiste Assmann 2018-01-30 08:08:04 +01:00 committed by Willy Tarreau
parent dfd35fd71a
commit db4c8521ca

View File

@ -1397,6 +1397,9 @@ int dns_link_resolution(void *requester, int requester_type, int requester_locke
req = srv->dns_requester;
if (!requester_locked)
HA_SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
req->requester_cb = snr_resolution_cb;
req->requester_error_cb = snr_resolution_error_cb;
}
else if (srvrq) {
if (srvrq->dns_requester == NULL) {
@ -1407,13 +1410,14 @@ int dns_link_resolution(void *requester, int requester_type, int requester_locke
}
else
req = srvrq->dns_requester;
req->requester_cb = snr_resolution_cb;
req->requester_error_cb = snr_resolution_error_cb;
}
else
goto err;
req->resolution = res;
req->requester_cb = snr_resolution_cb;
req->requester_error_cb = snr_resolution_error_cb;
LIST_ADDQ(&res->requesters, &req->list);
return 0;