mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-04 11:12:02 +00:00
MINOR: cfgparse: Rework peers frontend init.
Even if not already the case, we suppose that the frontend "peers" section may have been already initialized outside of "peer" line, we seperate their initializations from their binding initializations. May be backported to 1.5 and newer.
This commit is contained in:
parent
4ba5198899
commit
91694d51f7
@ -658,39 +658,37 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
||||
/* Current is local peer, it define a frontend */
|
||||
newpeer->local = 1;
|
||||
|
||||
if (!curpeers->peers_fe) {
|
||||
if (init_peers_frontend(file, linenum, args[1], curpeers) != 0) {
|
||||
if (!curpeers->peers_fe &&
|
||||
init_peers_frontend(file, linenum, args[1], curpeers) != 0) {
|
||||
ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
|
||||
err_code |= ERR_ALERT | ERR_ABORT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
bind_conf = bind_conf_alloc(curpeers->peers_fe, file, linenum, args[2], xprt_get(XPRT_RAW));
|
||||
|
||||
if (!str2listener(args[2], curpeers->peers_fe, bind_conf, file, linenum, &errmsg)) {
|
||||
if (errmsg && *errmsg) {
|
||||
indent_msg(&errmsg, 2);
|
||||
ha_alert("parsing [%s:%d] : '%s %s' : %s\n", file, linenum, args[0], args[1], errmsg);
|
||||
}
|
||||
else
|
||||
ha_alert("parsing [%s:%d] : '%s %s' : error encountered while parsing listening address %s.\n",
|
||||
file, linenum, args[0], args[1], args[2]);
|
||||
err_code |= ERR_FATAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
|
||||
l->maxaccept = 1;
|
||||
l->maxconn = curpeers->peers_fe->maxconn;
|
||||
l->backlog = curpeers->peers_fe->backlog;
|
||||
l->accept = session_accept_fd;
|
||||
l->analysers |= curpeers->peers_fe->fe_req_ana;
|
||||
l->default_target = curpeers->peers_fe->default_target;
|
||||
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
|
||||
global.maxsock += l->maxconn;
|
||||
}
|
||||
cfg_peers->local = newpeer;
|
||||
}
|
||||
|
||||
bind_conf = bind_conf_alloc(curpeers->peers_fe, file, linenum, args[2], xprt_get(XPRT_RAW));
|
||||
|
||||
if (!str2listener(args[2], curpeers->peers_fe, bind_conf, file, linenum, &errmsg)) {
|
||||
if (errmsg && *errmsg) {
|
||||
indent_msg(&errmsg, 2);
|
||||
ha_alert("parsing [%s:%d] : '%s %s' : %s\n", file, linenum, args[0], args[1], errmsg);
|
||||
}
|
||||
else
|
||||
ha_alert("parsing [%s:%d] : '%s %s' : error encountered while parsing listening address %s.\n",
|
||||
file, linenum, args[0], args[1], args[2]);
|
||||
err_code |= ERR_FATAL;
|
||||
goto out;
|
||||
}
|
||||
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
|
||||
l->maxaccept = 1;
|
||||
l->maxconn = curpeers->peers_fe->maxconn;
|
||||
l->backlog = curpeers->peers_fe->backlog;
|
||||
l->accept = session_accept_fd;
|
||||
l->analysers |= curpeers->peers_fe->fe_req_ana;
|
||||
l->default_target = curpeers->peers_fe->default_target;
|
||||
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
|
||||
global.maxsock += l->maxconn;
|
||||
}
|
||||
cfg_peers->local = newpeer;
|
||||
} /* neither "peer" nor "peers" */
|
||||
else if (!strcmp(args[0], "disabled")) { /* disables this peers section */
|
||||
curpeers->state = PR_STSTOPPED;
|
||||
|
Loading…
Reference in New Issue
Block a user