parent
5befb9d616
commit
c1f6fb797b
|
|
@ -239,17 +239,17 @@ int sf_load_global_config_ex(const char *server_name,
|
||||||
sf_set_global_base_path(pBasePath);
|
sf_set_global_base_path(pBasePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
chopPath(SF_G_BASE_PATH);
|
chopPath(SF_G_BASE_PATH_STR);
|
||||||
if (!fileExists(SF_G_BASE_PATH)) {
|
if (!fileExists(SF_G_BASE_PATH_STR)) {
|
||||||
logError("file: "__FILE__", line: %d, "
|
logError("file: "__FILE__", line: %d, "
|
||||||
"\"%s\" can't be accessed, error info: %s",
|
"\"%s\" can't be accessed, error info: %s",
|
||||||
__LINE__, SF_G_BASE_PATH, strerror(errno));
|
__LINE__, SF_G_BASE_PATH_STR, strerror(errno));
|
||||||
return errno != 0 ? errno : ENOENT;
|
return errno != 0 ? errno : ENOENT;
|
||||||
}
|
}
|
||||||
if (!isDir(SF_G_BASE_PATH)) {
|
if (!isDir(SF_G_BASE_PATH_STR)) {
|
||||||
logError("file: "__FILE__", line: %d, "
|
logError("file: "__FILE__", line: %d, "
|
||||||
"\"%s\" is not a directory!",
|
"\"%s\" is not a directory!",
|
||||||
__LINE__, SF_G_BASE_PATH);
|
__LINE__, SF_G_BASE_PATH_STR);
|
||||||
return ENOTDIR;
|
return ENOTDIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -340,7 +340,7 @@ int sf_load_global_config_ex(const char *server_name,
|
||||||
ini_ctx->section_name = old_section_name;
|
ini_ctx->section_name = old_section_name;
|
||||||
|
|
||||||
load_log_level(ini_ctx->context);
|
load_log_level(ini_ctx->context);
|
||||||
if ((result=log_set_prefix(SF_G_BASE_PATH, server_name)) != 0) {
|
if ((result=log_set_prefix(SF_G_BASE_PATH_STR, server_name)) != 0) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -525,7 +525,7 @@ void sf_global_config_to_string(char *output, const int size)
|
||||||
"network_timeout=%d, thread_stack_size=%d KB, "
|
"network_timeout=%d, thread_stack_size=%d KB, "
|
||||||
"max_pkg_size=%d KB, min_buff_size=%d KB, "
|
"max_pkg_size=%d KB, min_buff_size=%d KB, "
|
||||||
"max_buff_size=%d KB, tcp_quick_ack=%d, log_level=%s, "
|
"max_buff_size=%d KB, tcp_quick_ack=%d, log_level=%s, "
|
||||||
"run_by_group=%s, run_by_user=%s, ", SF_G_BASE_PATH,
|
"run_by_group=%s, run_by_user=%s, ", SF_G_BASE_PATH_STR,
|
||||||
g_sf_global_vars.max_connections,
|
g_sf_global_vars.max_connections,
|
||||||
g_sf_global_vars.connect_timeout,
|
g_sf_global_vars.connect_timeout,
|
||||||
g_sf_global_vars.network_timeout,
|
g_sf_global_vars.network_timeout,
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,8 @@ extern "C" {
|
||||||
extern SFGlobalVariables g_sf_global_vars;
|
extern SFGlobalVariables g_sf_global_vars;
|
||||||
extern SFContext g_sf_context;
|
extern SFContext g_sf_context;
|
||||||
|
|
||||||
#define SF_G_BASE_PATH g_sf_global_vars.base_path.str
|
#define SF_G_BASE_PATH_STR g_sf_global_vars.base_path.str
|
||||||
|
#define SF_G_BASE_PATH_INITED g_sf_global_vars.base_path.inited
|
||||||
#define SF_G_CONTINUE_FLAG g_sf_global_vars.continue_flag
|
#define SF_G_CONTINUE_FLAG g_sf_global_vars.continue_flag
|
||||||
#define SF_G_CONNECT_TIMEOUT g_sf_global_vars.connect_timeout
|
#define SF_G_CONNECT_TIMEOUT g_sf_global_vars.connect_timeout
|
||||||
#define SF_G_NETWORK_TIMEOUT g_sf_global_vars.network_timeout
|
#define SF_G_NETWORK_TIMEOUT g_sf_global_vars.network_timeout
|
||||||
|
|
@ -201,8 +202,9 @@ void sf_log_config_ex(const char *other_config);
|
||||||
|
|
||||||
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, sizeof(SF_G_BASE_PATH), "%s", base_path);
|
snprintf(SF_G_BASE_PATH_STR, sizeof(SF_G_BASE_PATH_STR),
|
||||||
g_sf_global_vars.base_path.inited = true;
|
"%s", base_path);
|
||||||
|
SF_G_BASE_PATH_INITED = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -539,7 +539,7 @@ static void sigDumpHandler(int sig)
|
||||||
bDumpFlag = true;
|
bDumpFlag = true;
|
||||||
|
|
||||||
snprintf(filename, sizeof(filename),
|
snprintf(filename, sizeof(filename),
|
||||||
"%s/logs/sf_dump.log", SF_G_BASE_PATH);
|
"%s/logs/sf_dump.log", SF_G_BASE_PATH_STR);
|
||||||
//manager_dump_global_vars_to_file(filename);
|
//manager_dump_global_vars_to_file(filename);
|
||||||
|
|
||||||
bDumpFlag = false;
|
bDumpFlag = false;
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ int sf_logger_init(LogContext *pContext, const char *filename_prefix)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((result=log_set_prefix_ex(pContext, SF_G_BASE_PATH,
|
if ((result=log_set_prefix_ex(pContext, SF_G_BASE_PATH_STR,
|
||||||
filename_prefix)) != 0)
|
filename_prefix)) != 0)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue