mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-19 04:07:04 +00:00
MINOR: quic: use dynamic cc_algo on bind_conf
A QUIC congestion algorithm can be specified on the bind line via keyword quic-cc-algo. As such, bind_conf structure has a member quic_cc_algo. Previously, if quic-cc-algo was set, bind_conf member was initialized to one of the globally defined CC algo structure. This patch changes bind_conf quic_cc_algo initialization to point to a dynamically allocated copy of CC algo structure. With this change, it will be possible to tweak individually each CC algo of a bind line. This will be used to activate pacing on top of the congestion algorithm. As bind_conf member is dynamically allocated now, its member is now freed via free_proxy() to prevent any leak.
This commit is contained in:
parent
796446a15e
commit
a6504c9cfb
@ -73,10 +73,16 @@ static unsigned long parse_window_size(const char *kw, char *value,
|
||||
static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px,
|
||||
struct bind_conf *conf, char **err)
|
||||
{
|
||||
struct quic_cc_algo *cc_algo;
|
||||
struct quic_cc_algo *cc_algo = NULL;
|
||||
const char *algo = NULL;
|
||||
char *arg;
|
||||
|
||||
cc_algo = calloc(1, sizeof(struct quic_cc_algo));
|
||||
if (!cc_algo) {
|
||||
memprintf(err, "'%s' : out of memory", args[cur_arg]);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!*args[cur_arg + 1]) {
|
||||
memprintf(err, "'%s' : missing control congestion algorithm", args[cur_arg]);
|
||||
goto fail;
|
||||
@ -86,13 +92,13 @@ static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px,
|
||||
if (strncmp(arg, QUIC_CC_NEWRENO_STR, strlen(QUIC_CC_NEWRENO_STR)) == 0) {
|
||||
/* newreno */
|
||||
algo = QUIC_CC_NEWRENO_STR;
|
||||
cc_algo = &quic_cc_algo_nr;
|
||||
*cc_algo = quic_cc_algo_nr;
|
||||
arg += strlen(QUIC_CC_NEWRENO_STR);
|
||||
}
|
||||
else if (strncmp(arg, QUIC_CC_CUBIC_STR, strlen(QUIC_CC_CUBIC_STR)) == 0) {
|
||||
/* cubic */
|
||||
algo = QUIC_CC_CUBIC_STR;
|
||||
cc_algo = &quic_cc_algo_cubic;
|
||||
*cc_algo = quic_cc_algo_cubic;
|
||||
arg += strlen(QUIC_CC_CUBIC_STR);
|
||||
}
|
||||
else if (strncmp(arg, QUIC_CC_NO_CC_STR, strlen(QUIC_CC_NO_CC_STR)) == 0) {
|
||||
@ -104,7 +110,7 @@ static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px,
|
||||
}
|
||||
|
||||
algo = QUIC_CC_NO_CC_STR;
|
||||
cc_algo = &quic_cc_algo_nocc;
|
||||
*cc_algo = quic_cc_algo_nocc;
|
||||
arg += strlen(QUIC_CC_NO_CC_STR);
|
||||
}
|
||||
else {
|
||||
@ -132,6 +138,7 @@ static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px,
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
free(cc_algo);
|
||||
return ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
|
||||
|
@ -387,6 +387,9 @@ void free_proxy(struct proxy *p)
|
||||
LIST_DELETE(&bind_conf->by_fe);
|
||||
free(bind_conf->guid_prefix);
|
||||
free(bind_conf->rhttp_srvname);
|
||||
#ifdef USE_QUIC
|
||||
free(bind_conf->quic_cc_algo);
|
||||
#endif
|
||||
free(bind_conf);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user