From: Nick Porter Date: Wed, 31 Jan 2024 17:50:41 +0000 (+0000) Subject: Align Oracle spool.max parsing with pool.max X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d6dc742564bfbd665355d448a3659a08995e38b;p=thirdparty%2Ffreeradius-server.git Align Oracle spool.max parsing with pool.max If not set, matches the number of worker threads --- diff --git a/src/modules/rlm_sql/drivers/rlm_sql_oracle/rlm_sql_oracle.c b/src/modules/rlm_sql/drivers/rlm_sql_oracle/rlm_sql_oracle.c index 8e15995f95d..aaf327d37db 100644 --- a/src/modules/rlm_sql/drivers/rlm_sql_oracle/rlm_sql_oracle.c +++ b/src/modules/rlm_sql/drivers/rlm_sql_oracle/rlm_sql_oracle.c @@ -48,6 +48,8 @@ DIAG_ON(unused-macros) #include "rlm_sql.h" +static int max_dflt(CONF_PAIR **out, void *parent, CONF_SECTION *cs, fr_token_t quote, conf_parser_t const *rule); + typedef struct { OCIEnv *env; //!< Number of columns associated with the result set OCIError *error; //!< Oracle error handle @@ -76,7 +78,7 @@ static const conf_parser_t spool_config[] = { { FR_CONF_OFFSET("stmt_cache_size", rlm_sql_oracle_t, stmt_cache_size), .dflt = "32" }, { FR_CONF_OFFSET("timeout", rlm_sql_oracle_t, spool_timeout), .dflt = "0" }, { FR_CONF_OFFSET("min", rlm_sql_oracle_t, spool_min), .dflt = "1" }, - { FR_CONF_OFFSET("max", rlm_sql_oracle_t, spool_max), .dflt = "2" }, + { FR_CONF_OFFSET("max", rlm_sql_oracle_t, spool_max), .dflt_func = max_dflt }, { FR_CONF_OFFSET("inc", rlm_sql_oracle_t, spool_inc), .dflt = "1" }, CONF_PARSER_TERMINATOR }; @@ -86,6 +88,17 @@ static const conf_parser_t driver_config[] = { CONF_PARSER_TERMINATOR }; +static int max_dflt(CONF_PAIR **out, UNUSED void *parent, CONF_SECTION *cs, fr_token_t quote, conf_parser_t const *rule) +{ + char *strvalue; + + strvalue = talloc_asprintf(NULL, "%u", main_config->max_workers); + *out = cf_pair_alloc(cs, rule->name1, strvalue, T_OP_EQ, T_BARE_WORD, quote); + talloc_free(strvalue); + + return 0; +} + #define MAX_DATASTR_LEN 64 /** Write the last Oracle error out to a buffer