mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-27 16:11:03 +00:00
MINOR: peers: centralize configuration of the peers frontend
This is in order to stop exporting the peer_accept() function.
This commit is contained in:
parent
9ff95bb18c
commit
91d9628a51
@ -29,8 +29,7 @@
|
||||
#include <types/peers.h>
|
||||
|
||||
void peers_register_table(struct peers *, struct stktable *table);
|
||||
|
||||
int peer_accept(struct session *);
|
||||
void peers_setup_frontend(struct proxy *fe);
|
||||
|
||||
#endif /* _PROTO_PEERS_H */
|
||||
|
||||
|
@ -1861,17 +1861,10 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
||||
|
||||
init_new_proxy(curpeers->peers_fe);
|
||||
curpeers->peers_fe->parent = curpeers;
|
||||
|
||||
curpeers->peers_fe->last_change = now.tv_sec;
|
||||
curpeers->peers_fe->id = strdup(args[1]);
|
||||
curpeers->peers_fe->cap = PR_CAP_FE;
|
||||
curpeers->peers_fe->maxconn = 0;
|
||||
curpeers->peers_fe->conn_retries = CONN_RETRIES;
|
||||
curpeers->peers_fe->timeout.client = MS_TO_TICKS(5000);
|
||||
curpeers->peers_fe->accept = peer_accept;
|
||||
curpeers->peers_fe->options2 |= PR_O2_INDEPSTR | PR_O2_SMARTCON | PR_O2_SMARTACC;
|
||||
curpeers->peers_fe->conf.args.file = curpeers->peers_fe->conf.file = strdup(file);
|
||||
curpeers->peers_fe->conf.args.line = curpeers->peers_fe->conf.line = linenum;
|
||||
peers_setup_frontend(curpeers->peers_fe);
|
||||
|
||||
bind_conf = bind_conf_alloc(&curpeers->peers_fe->conf.bind, file, linenum, args[2]);
|
||||
|
||||
|
14
src/peers.c
14
src/peers.c
@ -1094,7 +1094,7 @@ static void peer_session_forceshutdown(struct session * session)
|
||||
* value in case of success, or zero if it is a success but the session must be
|
||||
* closed ASAP and ignored.
|
||||
*/
|
||||
int peer_accept(struct session *s)
|
||||
static int peer_accept(struct session *s)
|
||||
{
|
||||
s->target = &peer_applet.obj_type;
|
||||
/* no need to initialize the applet, it will start with st0=st1 = 0 */
|
||||
@ -1117,6 +1117,18 @@ int peer_accept(struct session *s)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Pre-configures a peers frontend to accept incoming connections */
|
||||
void peers_setup_frontend(struct proxy *fe)
|
||||
{
|
||||
fe->last_change = now.tv_sec;
|
||||
fe->cap = PR_CAP_FE;
|
||||
fe->maxconn = 0;
|
||||
fe->conn_retries = CONN_RETRIES;
|
||||
fe->timeout.client = MS_TO_TICKS(5000);
|
||||
fe->accept = peer_accept;
|
||||
fe->options2 |= PR_O2_INDEPSTR | PR_O2_SMARTCON | PR_O2_SMARTACC;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new peer session in assigned state (connect will start automatically)
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user