13
13
#include <haproxy/global.h>
14
14
#include <haproxy/listener.h>
15
15
#include <haproxy/proxy.h>
16
- #include <haproxy/quic_cc-t .h>
16
+ #include <haproxy/quic_cc.h>
17
17
#include <haproxy/quic_rules.h>
18
18
#include <haproxy/tools.h>
19
19
@@ -69,12 +69,31 @@ static unsigned long parse_window_size(const char *kw, char *value,
69
69
return 0 ;
70
70
}
71
71
72
+ static int parse_burst (const char * kw , char * value , char * * end_opt , char * * err )
73
+ {
74
+ int burst ;
75
+
76
+ errno = 0 ;
77
+ burst = strtoul (value , end_opt , 0 );
78
+ if (* end_opt == value || errno != 0 ) {
79
+ memprintf (err , "'%s' : could not burst value" , kw );
80
+ goto fail ;
81
+ }
82
+
83
+ return burst ;
84
+
85
+ fail :
86
+ return -1 ;
87
+ }
88
+
72
89
/* parse "quic-cc-algo" bind keyword */
73
90
static int bind_parse_quic_cc_algo (char * * args , int cur_arg , struct proxy * px ,
74
91
struct bind_conf * conf , char * * err )
75
92
{
93
+ const char * pacing_pfx = "-pacing" ;
76
94
struct quic_cc_algo * cc_algo ;
77
95
const char * algo = NULL ;
96
+ int pacing = 0 ;
78
97
char * arg ;
79
98
80
99
if (!* args [cur_arg + 1 ]) {
@@ -94,6 +113,19 @@ static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px,
94
113
algo = QUIC_CC_CUBIC_STR ;
95
114
cc_algo = & quic_cc_algo_cubic ;
96
115
arg += strlen (QUIC_CC_CUBIC_STR );
116
+
117
+ if (strncmp (arg , pacing_pfx , strlen (pacing_pfx )) == 0 ) {
118
+ if (!experimental_directives_allowed ) {
119
+ memprintf (err , "'%s' : support for pacing is experimental, must be allowed via a global "
120
+ "'expose-experimental-directives'\n" , args [cur_arg ]);
121
+ goto fail ;
122
+ }
123
+
124
+ cc_algo -> pacing_rate = quic_cc_default_pacing_rate ;
125
+ cc_algo -> pacing_burst = quic_cc_default_pacing_burst ;
126
+ pacing = 1 ;
127
+ arg += strlen (pacing_pfx );
128
+ }
97
129
}
98
130
else if (strncmp (arg , QUIC_CC_NO_CC_STR , strlen (QUIC_CC_NO_CC_STR )) == 0 ) {
99
131
/* nocc */
@@ -127,6 +159,18 @@ static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px,
127
159
128
160
conf -> max_cwnd = cwnd ;
129
161
}
162
+ else if (pacing ) {
163
+ int burst = parse_burst (args [cur_arg ], arg , & end_opt , err );
164
+ if (burst < 0 )
165
+ goto fail ;
166
+
167
+ if (* end_opt != ')' ) {
168
+ memprintf (err , "'%s' : expects %s(<burst>)" , args [cur_arg + 1 ], algo );
169
+ goto fail ;
170
+ }
171
+
172
+ conf -> quic_pacing_burst = burst ;
173
+ }
130
174
else {
131
175
if (* arg ++ != ')' ) {
132
176
memprintf (err , "'%s' : unexpected extra argument for '%s' algorithm" , args [cur_arg ], algo );
0 commit comments