MINOR: listener: remove the useless ->default_target field

This field is used by stream_new() to optionally set the applet the
stream will connect to for simple proxies like the CLI for example.
But it has never been configurable to anything and is always strictly
equal to the frontend's ->default_target. Let's just drop it and make
stream_new() only use the frontend's. It makes more sense anyway as
we don't want the proxy to work differently based on the "bind" line.
This idea was brought in 1.6 hoping that the h2 implementation would
use applets for decoding (which was dropped after the very first
attempt in 1.8).
This commit is contained in:
Willy Tarreau 2023-01-12 19:18:34 +01:00
parent 3083615410
commit d5983cef80
5 changed files with 4 additions and 10 deletions

View File

@ -245,7 +245,6 @@ struct listener {
struct fe_counters *counters; /* statistics counters */
int nbconn; /* current number of connections on this listener */
enum obj_type *default_target; /* default target to use for accepted sessions or NULL */
/* cache line boundary */
struct mt_list wait_queue; /* link element to make the listener wait for something (LI_LIMITED) */
unsigned int thr_idx; /* thread indexes for queue distribution : (t2<<16)+t1 */

View File

@ -747,7 +747,6 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
* Newly allocated listener is at the end of the list
*/
l = LIST_ELEM(bind_conf->listeners.p, typeof(l), by_bind);
l->default_target = curpeers->peers_fe->default_target;
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
global.maxsock++; /* for the listening socket */
@ -972,7 +971,6 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
* Newly allocated listener is at the end of the list
*/
l = LIST_ELEM(bind_conf->listeners.p, typeof(l), by_bind);
l->default_target = curpeers->peers_fe->default_target;
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
global.maxsock++; /* for the listening socket */
}
@ -4329,8 +4327,6 @@ init_proxies_list_stage2:
}
#endif
listener->default_target = curproxy->default_target;
if (!LIST_ISEMPTY(&curproxy->tcp_req.l4_rules))
listener->options |= LI_O_TCP_L4_RULES;

View File

@ -552,8 +552,8 @@ static int cli_parse_global(char **args, int section_type, struct proxy *curpx,
}
bind_conf->accept = session_accept_fd;
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
l->default_target = global.cli_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++; /* for the listening socket */
@ -3045,8 +3045,8 @@ struct bind_conf *mworker_cli_proxy_new_listener(char *line)
bind_conf->accept = session_accept_fd;
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
l->default_target = mworker_proxy->default_target;
/* don't make the peers subject to global limits and don't close it in the master */
l->options |= LI_O_UNLIMITED;
l->rx.flags |= RX_F_MWORKER; /* we are keeping this FD in the master */
@ -3112,8 +3112,8 @@ int mworker_cli_sockpair_new(struct mworker_proc *mworker_proc, int proc)
ha_free(&path);
bind_conf->accept = session_accept_fd;
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
l->default_target = global.cli_fe->default_target;
l->options |= (LI_O_UNLIMITED | LI_O_NOSTOP);
HA_ATOMIC_INC(&unstoppable_jobs);
/* it's a sockpair but we don't want to keep the fd in the master */

View File

@ -3826,7 +3826,6 @@ int cfg_parse_log_forward(const char *file, int linenum, char **args, int kwm)
}
}
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
l->default_target = cfg_log_forward->default_target;
global.maxsock++;
}
cur_arg++;

View File

@ -491,7 +491,7 @@ struct stream *stream_new(struct session *sess, struct stconn *sc, struct buffer
}
stream_init_srv_conn(s);
s->target = sess->listener ? sess->listener->default_target : NULL;
s->target = sess->fe->default_target;
s->pend_pos = NULL;
s->priority_class = 0;