From: Amaury Denoyelle Date: Thu, 10 Dec 2020 12:43:55 +0000 (+0100) Subject: MINOR: frontend: add client timeout sample fetch X-Git-Tag: v2.4-dev3~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da184d5306d1393a291e7230d7c21fb77e092260;p=thirdparty%2Fhaproxy.git MINOR: frontend: add client timeout sample fetch Add a sample fetch named fe_client_timeout to return the configuration value for the client timeout on a frontend. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index d4bfd1c65f..c32a85b23a 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -16978,6 +16978,10 @@ fe_name : string backends to check from which frontend it was called, or to stick all users coming via a same frontend to the same server. +fe_client_timeout : integer + Returns the configuration value in millisecond for the client timeout of the + current frontend. + sc_bytes_in_rate([,]) : integer sc0_bytes_in_rate([
]) : integer sc1_bytes_in_rate([
]) : integer diff --git a/src/frontend.c b/src/frontend.c index 3da48f2a4e..52527118b2 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -254,17 +254,27 @@ smp_fetch_fe_conn(const struct arg *args, struct sample *smp, const char *kw, vo return 1; } +static int +smp_fetch_fe_client_timeout(const struct arg *args, struct sample *smp, const char *km, void *private) +{ + smp->flags = SMP_F_VOL_TXN; + smp->data.type = SMP_T_SINT; + smp->data.u.sint = TICKS_TO_MS(smp->sess->fe->timeout.client); + return 1; +} + /* Note: must not be declared as its list will be overwritten. * Please take care of keeping this list alphabetically sorted. */ static struct sample_fetch_kw_list smp_kws = {ILH, { - { "fe_conn", smp_fetch_fe_conn, ARG1(1,FE), NULL, SMP_T_SINT, SMP_USE_INTRN, }, - { "fe_defbe", smp_fetch_fe_defbe, 0, NULL, SMP_T_STR, SMP_USE_FTEND, }, - { "fe_id", smp_fetch_fe_id, 0, NULL, SMP_T_SINT, SMP_USE_FTEND, }, - { "fe_name", smp_fetch_fe_name, 0, NULL, SMP_T_STR, SMP_USE_FTEND, }, - { "fe_req_rate", smp_fetch_fe_req_rate, ARG1(1,FE), NULL, SMP_T_SINT, SMP_USE_INTRN, }, - { "fe_sess_rate", smp_fetch_fe_sess_rate, ARG1(1,FE), NULL, SMP_T_SINT, SMP_USE_INTRN, }, + { "fe_client_timeout", smp_fetch_fe_client_timeout, 0, NULL, SMP_T_SINT, SMP_USE_FTEND, }, + { "fe_conn", smp_fetch_fe_conn, ARG1(1,FE), NULL, SMP_T_SINT, SMP_USE_INTRN, }, + { "fe_defbe", smp_fetch_fe_defbe, 0, NULL, SMP_T_STR, SMP_USE_FTEND, }, + { "fe_id", smp_fetch_fe_id, 0, NULL, SMP_T_SINT, SMP_USE_FTEND, }, + { "fe_name", smp_fetch_fe_name, 0, NULL, SMP_T_STR, SMP_USE_FTEND, }, + { "fe_req_rate", smp_fetch_fe_req_rate, ARG1(1,FE), NULL, SMP_T_SINT, SMP_USE_INTRN, }, + { "fe_sess_rate", smp_fetch_fe_sess_rate, ARG1(1,FE), NULL, SMP_T_SINT, SMP_USE_INTRN, }, { /* END */ }, }};