MEDIUM: listener: store the default target per listener

This will be useful later to state that some listeners have to use
certain decoders (typically an HTTP/2 decoder) regardless of the
regular processing applied to other listeners. For now it simply
defaults to the frontend's default target, and it is used by the
session.
This commit is contained in:
Willy Tarreau 2015-03-13 16:43:12 +01:00
parent 512fd00296
commit 10b688f2b4
4 changed files with 5 additions and 1 deletions

View File

@ -173,6 +173,7 @@ struct listener {
int (*accept)(struct listener *l, int fd, struct sockaddr_storage *addr); /* upper layer's accept() */
struct task * (*handler)(struct task *t); /* protocol handler. It is a task */
struct proxy *frontend; /* the frontend this listener belongs to, or NULL */
enum obj_type *default_target; /* default target to use for accepted sessions or NULL */
struct list wait_queue; /* link element to make the listener wait for something (LI_LIMITED) */
unsigned int analysers; /* bitmap of required protocol analysers */
int maxseg; /* for TCP, advertised MSS */

View File

@ -1887,6 +1887,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
l->accept = session_accept;
l->handler = process_session;
l->analysers |= ((struct proxy *)curpeers->peers_fe)->fe_req_ana;
l->default_target = ((struct proxy *)curpeers->peers_fe)->default_target;
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
global.maxsock += l->maxconn;
}
@ -7710,6 +7711,7 @@ int check_config_validity()
listener->accept = session_accept;
listener->handler = process_session;
listener->analysers |= curproxy->fe_req_ana;
listener->default_target = curproxy->default_target;
if (!LIST_ISEMPTY(&curproxy->tcp_req.l4_rules))
listener->options |= LI_O_TCP_RULES;

View File

@ -339,6 +339,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx
l->backlog = global.stats_fe->backlog;
l->accept = session_accept;
l->handler = process_session;
l->default_target = global.stats_fe->default_target;
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
l->nice = -64; /* we want to boost priority for local stats */
global.maxsock += l->maxconn;

View File

@ -481,7 +481,7 @@ int session_complete(struct session *s)
s->si[1].flags |= SI_FL_INDEP_STR;
session_init_srv_conn(s);
s->target = p->default_target; /* used by peers and CLI */
s->target = l->default_target; /* used by peers and CLI */
s->pend_pos = NULL;
/* init store persistence */