mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-11 03:31:36 +00:00
MINOR: sample: Add "quic_enabled" sample fetch
This sample fetch returns a boolean. True if the support for QUIC transport protocol was built and if this protocol was not disabled by "no-quic" global option. Must be backported to 2.7.
This commit is contained in:
parent
12a0317fed
commit
33d11c464f
@ -18846,6 +18846,14 @@ queue([<backend>]) : integer
|
|||||||
possible action could be to reject new users but still accept old ones. See
|
possible action could be to reject new users but still accept old ones. See
|
||||||
also the "avg_queue", "be_conn", and "be_sess_rate" fetches.
|
also the "avg_queue", "be_conn", and "be_sess_rate" fetches.
|
||||||
|
|
||||||
|
quic_enabled : boolean
|
||||||
|
Warning: QUIC support in HAProxy is currently experimental. Configuration may
|
||||||
|
change without deprecation in the future.
|
||||||
|
|
||||||
|
Return true when the support for QUIC transport protocol was compiled and
|
||||||
|
if this procotol was not disabled by "no-quic" global option. See also "no-quic"
|
||||||
|
global option.
|
||||||
|
|
||||||
rand([<range>]) : integer
|
rand([<range>]) : integer
|
||||||
Returns a random integer value within a range of <range> possible values,
|
Returns a random integer value within a range of <range> possible values,
|
||||||
starting at zero. If the range is not specified, it defaults to 2^32, which
|
starting at zero. If the range is not specified, it defaults to 2^32, which
|
||||||
|
14
src/sample.c
14
src/sample.c
@ -4393,6 +4393,19 @@ static int smp_fetch_uuid(const struct arg *args, struct sample *smp, const char
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if QUIC support was compiled and was not disabled by "no-quic" global option */
|
||||||
|
static int smp_fetch_quic_enabled(const struct arg *args, struct sample *smp, const char *kw, void *private)
|
||||||
|
{
|
||||||
|
smp->data.type = SMP_T_BOOL;
|
||||||
|
smp->flags = 0;
|
||||||
|
#ifdef USE_QUIC
|
||||||
|
smp->data.u.sint = !(global.tune.options & GTUNE_NO_QUIC);
|
||||||
|
#else
|
||||||
|
smp->data.u.sint = 0;
|
||||||
|
#endif
|
||||||
|
return smp->data.u.sint;
|
||||||
|
}
|
||||||
|
|
||||||
/* Note: must not be declared <const> as its list will be overwritten.
|
/* Note: must not be declared <const> as its list will be overwritten.
|
||||||
* Note: fetches that may return multiple types must be declared as the lowest
|
* Note: fetches that may return multiple types must be declared as the lowest
|
||||||
* common denominator, the type that can be casted into all other ones. For
|
* common denominator, the type that can be casted into all other ones. For
|
||||||
@ -4407,6 +4420,7 @@ static struct sample_fetch_kw_list smp_kws = {ILH, {
|
|||||||
{ "hostname", smp_fetch_hostname, 0, NULL, SMP_T_STR, SMP_USE_CONST },
|
{ "hostname", smp_fetch_hostname, 0, NULL, SMP_T_STR, SMP_USE_CONST },
|
||||||
{ "nbproc", smp_fetch_nbproc,0, NULL, SMP_T_SINT, SMP_USE_CONST },
|
{ "nbproc", smp_fetch_nbproc,0, NULL, SMP_T_SINT, SMP_USE_CONST },
|
||||||
{ "proc", smp_fetch_proc, 0, NULL, SMP_T_SINT, SMP_USE_CONST },
|
{ "proc", smp_fetch_proc, 0, NULL, SMP_T_SINT, SMP_USE_CONST },
|
||||||
|
{ "quic_enabled", smp_fetch_quic_enabled, 0, NULL, SMP_T_BOOL, SMP_USE_CONST },
|
||||||
{ "thread", smp_fetch_thread, 0, NULL, SMP_T_SINT, SMP_USE_CONST },
|
{ "thread", smp_fetch_thread, 0, NULL, SMP_T_SINT, SMP_USE_CONST },
|
||||||
{ "rand", smp_fetch_rand, ARG1(0,SINT), NULL, SMP_T_SINT, SMP_USE_CONST },
|
{ "rand", smp_fetch_rand, ARG1(0,SINT), NULL, SMP_T_SINT, SMP_USE_CONST },
|
||||||
{ "stopping", smp_fetch_stopping, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN },
|
{ "stopping", smp_fetch_stopping, 0, NULL, SMP_T_BOOL, SMP_USE_INTRN },
|
||||||
|
Loading…
Reference in New Issue
Block a user