add function sf_load_global_base_path

posix_api
YuQing 2022-02-26 10:05:25 +08:00
parent 1ba160b6d7
commit 3e4ddce4a2
2 changed files with 20 additions and 8 deletions

View File

@ -219,17 +219,10 @@ int sf_load_slow_log_config_ex(IniFullContext *ini_ctx, LogContext *log_ctx,
return 0; return 0;
} }
int sf_load_global_config_ex(const char *server_name, int sf_load_global_base_path(IniFullContext *ini_ctx)
IniFullContext *ini_ctx, const bool load_network_params,
const int task_buffer_extra_size)
{ {
int result;
const char *old_section_name;
char *pBasePath; char *pBasePath;
char *pRunByGroup;
char *pRunByUser;
g_sf_global_vars.task_buffer_extra_size = task_buffer_extra_size;
if (!g_sf_global_vars.base_path.inited) { if (!g_sf_global_vars.base_path.inited) {
pBasePath = iniGetStrValue(NULL, "base_path", ini_ctx->context); pBasePath = iniGetStrValue(NULL, "base_path", ini_ctx->context);
if (pBasePath == NULL) { if (pBasePath == NULL) {
@ -255,6 +248,23 @@ int sf_load_global_config_ex(const char *server_name,
return ENOTDIR; return ENOTDIR;
} }
return 0;
}
int sf_load_global_config_ex(const char *server_name,
IniFullContext *ini_ctx, const bool load_network_params,
const int task_buffer_extra_size)
{
int result;
const char *old_section_name;
char *pRunByGroup;
char *pRunByUser;
if ((result=sf_load_global_base_path(ini_ctx)) != 0) {
return result;
}
g_sf_global_vars.task_buffer_extra_size = task_buffer_extra_size;
g_sf_global_vars.tcp_quick_ack = iniGetBoolValue(NULL, g_sf_global_vars.tcp_quick_ack = iniGetBoolValue(NULL,
"tcp_quick_ack", ini_ctx->context, true); "tcp_quick_ack", ini_ctx->context, true);
tcp_set_quick_ack(g_sf_global_vars.tcp_quick_ack); tcp_set_quick_ack(g_sf_global_vars.tcp_quick_ack);

View File

@ -205,6 +205,8 @@ void sf_log_config_ex(const char *other_config);
#define sf_log_config_to_string(log_cfg, caption, output, size) \ #define sf_log_config_to_string(log_cfg, caption, output, size) \
sf_log_config_to_string_ex(log_cfg, caption, NULL, output, size) sf_log_config_to_string_ex(log_cfg, caption, NULL, output, size)
int sf_load_global_base_path(IniFullContext *ini_ctx);
static inline void sf_set_global_base_path(const char *base_path) static inline void sf_set_global_base_path(const char *base_path)
{ {
snprintf(SF_G_BASE_PATH_STR, sizeof(SF_G_BASE_PATH_STR), snprintf(SF_G_BASE_PATH_STR, sizeof(SF_G_BASE_PATH_STR),