mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-25 15:11:10 +00:00
[MINOR] cleaned up the check_addr patch a bit
removed useless set_check_addr entry and rely on check_addr itself.
This commit is contained in:
parent
cec2e7ad1c
commit
0f03c6f60b
@ -68,8 +68,7 @@ struct server {
|
||||
#ifdef CONFIG_HAP_CTTPROXY
|
||||
struct sockaddr_in tproxy_addr; /* non-local address we want to bind to for connect() */
|
||||
#endif
|
||||
struct sockaddr_in check_addr;
|
||||
int set_check_addr ;
|
||||
struct sockaddr_in check_addr; /* the address to check, if different from <addr> */
|
||||
short check_port; /* the port to use for the health checks */
|
||||
int health; /* 0->rise-1 = bad; rise->rise+fall-1 = good */
|
||||
int rise, fall; /* time in iterations */
|
||||
|
@ -1197,7 +1197,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args)
|
||||
newsrv->rise = DEF_RISETIME;
|
||||
newsrv->fall = DEF_FALLTIME;
|
||||
newsrv->health = newsrv->rise; /* up, but will fall down at first failure */
|
||||
newsrv->set_check_addr = 0;
|
||||
|
||||
cur_arg = 3;
|
||||
while (*args[cur_arg]) {
|
||||
if (!strcmp(args[cur_arg], "cookie")) {
|
||||
@ -1220,7 +1220,6 @@ int cfg_parse_listen(const char *file, int linenum, char **args)
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "addr")) {
|
||||
newsrv->check_addr = *str2sa(args[cur_arg + 1]);
|
||||
newsrv->set_check_addr = 1;
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "port")) {
|
||||
@ -1306,13 +1305,16 @@ int cfg_parse_listen(const char *file, int linenum, char **args)
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
Alert("parsing [%s:%d] : server %s only supports options 'backup', 'cookie', 'check', 'inter', 'rise', 'fall', 'port', 'source', 'minconn', 'maxconn' and 'weight'.\n",
|
||||
Alert("parsing [%s:%d] : server %s only supports options 'backup', 'cookie', 'check', 'inter', 'rise', 'fall', 'addr', 'port', 'source', 'minconn', 'maxconn' and 'weight'.\n",
|
||||
file, linenum, newsrv->id);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (do_check) {
|
||||
if (!newsrv->check_port && newsrv->check_addr.sin_port)
|
||||
newsrv->check_port = newsrv->check_addr.sin_port;
|
||||
|
||||
if (!newsrv->check_port && !(newsrv->state & SRV_MAPPORTS))
|
||||
newsrv->check_port = realport; /* by default */
|
||||
if (!newsrv->check_port) {
|
||||
|
11
src/checks.c
11
src/checks.c
@ -249,16 +249,13 @@ int process_chk(struct task *t)
|
||||
//fprintf(stderr, "process_chk: 3\n");
|
||||
|
||||
|
||||
if ( s->set_check_addr == 1 )
|
||||
{
|
||||
/* we'll connect to the check addr specified on the server */
|
||||
if (s->check_addr.sin_addr.s_addr)
|
||||
/* we'll connect to the check addr specified on the server */
|
||||
sa = s->check_addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we'll connect to the addr on the server */
|
||||
/* we'll connect to the addr on the server */
|
||||
sa = s->addr;
|
||||
}
|
||||
|
||||
/* we'll connect to the check port on the server */
|
||||
sa.sin_port = htons(s->check_port);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user