MINOR: listener: allow thread kw for rhttp bind

Thanks to previous commit, a reverse HTTP listener is able to distribute
actively opened connections accross its threads. To be able to exploit
this, allow "thread" keyword for such a listener.

An extra check is added to explicitely forbids a reverse bind to span
multiple thread groups. Without this, multiple listeners instances will
be created, each with its owned "nbconn" value. This may surprise users
so for now, better to deactivate this possibility.
This commit is contained in:
Amaury Denoyelle 2023-11-23 17:31:05 +01:00
parent 3d0c7f2e2a
commit 71ed381249
2 changed files with 15 additions and 1 deletions

View File

@ -15773,6 +15773,10 @@ thread [<thread-group>/]<thread-set>[,...]
See also the "shards" keyword above that automates duplication of "bind"
lines and their assignment to multiple groups of threads.
This keyword is compatible with reverse HTTP binds. However, it is forbidden
to specify a thread set which spans accross several thread groups for such a
listener as this may caused "nbconn" to not work as intended.
tls-ticket-keys <keyfile>
Sets the TLS ticket keys file to load the keys from. The keys need to be 48
or 80 bytes long, depending if aes128 or aes256 is used, encoded with base64

View File

@ -2355,12 +2355,22 @@ static int bind_parse_shards(char **args, int cur_arg, struct proxy *px, struct
/* parse the "thread" bind keyword. This will replace any preset thread_set */
static int bind_parse_thread(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
{
const struct listener *l;
/* note that the thread set is zeroed before first call, and we don't
* want to reset it so that it remains possible to chain multiple
* "thread" directives.
*/
if (parse_thread_set(args[cur_arg+1], &conf->thread_set, err) < 0)
return ERR_ALERT | ERR_FATAL;
l = LIST_NEXT(&conf->listeners, struct listener *, by_bind);
if (l->rx.addr.ss_family == AF_CUST_RHTTP_SRV &&
atleast2(conf->thread_set.grps)) {
memprintf(err, "'%s' : reverse HTTP bind cannot span multiple thread groups.", args[cur_arg]);
return ERR_ALERT | ERR_FATAL;
}
return 0;
}
@ -2446,7 +2456,7 @@ static struct bind_kw_list bind_kws = { "ALL", { }, {
{ "process", bind_parse_process, 1, 0 }, /* set list of allowed process for this socket */
{ "proto", bind_parse_proto, 1, 0 }, /* set the proto to use for all incoming connections */
{ "shards", bind_parse_shards, 1, 0 }, /* set number of shards */
{ "thread", bind_parse_thread, 1, 0 }, /* set list of allowed threads for this socket */
{ "thread", bind_parse_thread, 1, 1 }, /* set list of allowed threads for this socket */
{ /* END */ },
}};