mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
MINOR: resolvers: Add function to change the srv status based on SRV resolution
srvrq_update_srv_status() update the server status based on result of SRV resolution. For now, it is only used from snr_update_srv_status() when appropriate.
This commit is contained in:
parent
51d5e3bda7
commit
5efdef24c1
@ -62,6 +62,7 @@ struct server *new_server(struct proxy *proxy);
|
|||||||
|
|
||||||
/* functions related to server name resolution */
|
/* functions related to server name resolution */
|
||||||
int srv_prepare_for_resolution(struct server *srv, const char *hostname);
|
int srv_prepare_for_resolution(struct server *srv, const char *hostname);
|
||||||
|
int srvrq_update_srv_status(struct server *s, int has_no_ip);
|
||||||
int snr_update_srv_status(struct server *s, int has_no_ip);
|
int snr_update_srv_status(struct server *s, int has_no_ip);
|
||||||
int srv_set_fqdn(struct server *srv, const char *fqdn, int resolv_locked);
|
int srv_set_fqdn(struct server *srv, const char *fqdn, int resolv_locked);
|
||||||
const char *srv_update_fqdn(struct server *server, const char *fqdn, const char *updater, int dns_locked);
|
const char *srv_update_fqdn(struct server *server, const char *fqdn, const char *updater, int dns_locked);
|
||||||
|
40
src/server.c
40
src/server.c
@ -2990,6 +2990,31 @@ out:
|
|||||||
return msg->area;
|
return msg->area;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* update server status based on result of SRV resolution
|
||||||
|
* returns:
|
||||||
|
* 0 if server status is updated
|
||||||
|
* 1 if server status has not changed
|
||||||
|
*
|
||||||
|
* Must be called with the server lock held.
|
||||||
|
*/
|
||||||
|
int srvrq_update_srv_status(struct server *s, int has_no_ip)
|
||||||
|
{
|
||||||
|
if (!s->srvrq)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* since this server has an IP, it can go back in production */
|
||||||
|
if (has_no_ip == 0) {
|
||||||
|
srv_clr_admin_flag(s, SRV_ADMF_RMAINT);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s->next_admin & SRV_ADMF_RMAINT)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
srv_set_admin_flag(s, SRV_ADMF_RMAINT, "entry removed from SRV record");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* update server status based on result of name resolution
|
* update server status based on result of name resolution
|
||||||
@ -3006,19 +3031,8 @@ int snr_update_srv_status(struct server *s, int has_no_ip)
|
|||||||
int exp;
|
int exp;
|
||||||
|
|
||||||
/* If resolution is NULL we're dealing with SRV records Additional records */
|
/* If resolution is NULL we're dealing with SRV records Additional records */
|
||||||
if (resolution == NULL) {
|
if (resolution == NULL)
|
||||||
/* since this server has an IP, it can go back in production */
|
return srvrq_update_srv_status(s, has_no_ip);
|
||||||
if (has_no_ip == 0) {
|
|
||||||
srv_clr_admin_flag(s, SRV_ADMF_RMAINT);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s->next_admin & SRV_ADMF_RMAINT)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
srv_set_admin_flag(s, SRV_ADMF_RMAINT, "entry removed from SRV record");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (resolution->status) {
|
switch (resolution->status) {
|
||||||
case RSLV_STATUS_NONE:
|
case RSLV_STATUS_NONE:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user