upgrade version to V1.1.8
parent
02eaad6a89
commit
561b7c8d7c
|
|
@ -3,7 +3,7 @@
|
|||
%define CommitVersion %(echo $COMMIT_VERSION)
|
||||
|
||||
Name: libserverframe
|
||||
Version: 1.1.7
|
||||
Version: 1.1.8
|
||||
Release: 1%{?dist}
|
||||
Summary: network framework library
|
||||
License: AGPL v3.0
|
||||
|
|
@ -13,9 +13,9 @@ Source: http://github.com/happyfish100/libserverframe/%{name}-%{version}.tar.gz
|
|||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildRequires: libfastcommon-devel >= 1.0.50
|
||||
BuildRequires: libfastcommon-devel >= 1.0.51
|
||||
Requires: %__cp %__mv %__chmod %__grep %__mkdir %__install %__id
|
||||
Requires: libfastcommon >= 1.0.50
|
||||
Requires: libfastcommon >= 1.0.51
|
||||
|
||||
%description
|
||||
common framework library
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@
|
|||
|
||||
SFGlobalVariables g_sf_global_vars = {
|
||||
DEFAULT_CONNECT_TIMEOUT, DEFAULT_NETWORK_TIMEOUT,
|
||||
{'/', 't', 'm', 'p', '\0'}, true, true, DEFAULT_MAX_CONNECTONS,
|
||||
{{'/', 't', 'm', 'p', '\0'}, false},
|
||||
true, true, DEFAULT_MAX_CONNECTONS,
|
||||
SF_DEF_MAX_PACKAGE_SIZE, SF_DEF_MIN_BUFF_SIZE,
|
||||
SF_DEF_MAX_BUFF_SIZE, 0, SF_DEF_THREAD_STACK_SIZE,
|
||||
0, 0, 0, {'\0'}, {'\0'}, {SF_DEF_SYNC_LOG_BUFF_INTERVAL, false},
|
||||
|
|
@ -227,6 +228,7 @@ int sf_load_global_config_ex(const char *server_name,
|
|||
char *pRunByUser;
|
||||
|
||||
g_sf_global_vars.task_buffer_extra_size = task_buffer_extra_size;
|
||||
if (!g_sf_global_vars.base_path.inited) {
|
||||
pBasePath = iniGetStrValue(NULL, "base_path", ini_ctx->context);
|
||||
if (pBasePath == NULL) {
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
|
|
@ -234,20 +236,21 @@ int sf_load_global_config_ex(const char *server_name,
|
|||
"\"base_path\"!", __LINE__, ini_ctx->filename);
|
||||
return ENOENT;
|
||||
}
|
||||
snprintf(SF_G_BASE_PATH, sizeof(SF_G_BASE_PATH), "%s", pBasePath);
|
||||
g_sf_global_vars.base_path.inited = true;
|
||||
}
|
||||
|
||||
snprintf(g_sf_global_vars.base_path, sizeof(g_sf_global_vars.base_path),
|
||||
"%s", pBasePath);
|
||||
chopPath(g_sf_global_vars.base_path);
|
||||
if (!fileExists(g_sf_global_vars.base_path)) {
|
||||
chopPath(SF_G_BASE_PATH);
|
||||
if (!fileExists(SF_G_BASE_PATH)) {
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"\"%s\" can't be accessed, error info: %s",
|
||||
__LINE__, g_sf_global_vars.base_path, strerror(errno));
|
||||
__LINE__, SF_G_BASE_PATH, strerror(errno));
|
||||
return errno != 0 ? errno : ENOENT;
|
||||
}
|
||||
if (!isDir(g_sf_global_vars.base_path)) {
|
||||
if (!isDir(SF_G_BASE_PATH)) {
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"\"%s\" is not a directory!",
|
||||
__LINE__, g_sf_global_vars.base_path);
|
||||
__LINE__, SF_G_BASE_PATH);
|
||||
return ENOTDIR;
|
||||
}
|
||||
|
||||
|
|
@ -338,7 +341,7 @@ int sf_load_global_config_ex(const char *server_name,
|
|||
ini_ctx->section_name = old_section_name;
|
||||
|
||||
load_log_level(ini_ctx->context);
|
||||
if ((result=log_set_prefix(g_sf_global_vars.base_path, server_name)) != 0) {
|
||||
if ((result=log_set_prefix(SF_G_BASE_PATH, server_name)) != 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -523,8 +526,7 @@ void sf_global_config_to_string(char *output, const int size)
|
|||
"network_timeout=%d, thread_stack_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, "
|
||||
"run_by_group=%s, run_by_user=%s, ",
|
||||
g_sf_global_vars.base_path,
|
||||
"run_by_group=%s, run_by_user=%s, ", SF_G_BASE_PATH,
|
||||
g_sf_global_vars.max_connections,
|
||||
g_sf_global_vars.connect_timeout,
|
||||
g_sf_global_vars.network_timeout,
|
||||
|
|
|
|||
|
|
@ -32,7 +32,10 @@ typedef struct sf_connection_stat {
|
|||
typedef struct sf_global_variables {
|
||||
int connect_timeout;
|
||||
int network_timeout;
|
||||
char base_path[MAX_PATH_SIZE];
|
||||
struct {
|
||||
char str[MAX_PATH_SIZE];
|
||||
bool inited;
|
||||
} base_path;
|
||||
|
||||
volatile bool continue_flag;
|
||||
bool tcp_quick_ack;
|
||||
|
|
@ -67,7 +70,7 @@ extern "C" {
|
|||
extern SFGlobalVariables g_sf_global_vars;
|
||||
extern SFContext g_sf_context;
|
||||
|
||||
#define SF_G_BASE_PATH g_sf_global_vars.base_path
|
||||
#define SF_G_BASE_PATH g_sf_global_vars.base_path.str
|
||||
#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_NETWORK_TIMEOUT g_sf_global_vars.network_timeout
|
||||
|
|
|
|||
|
|
@ -539,7 +539,7 @@ static void sigDumpHandler(int sig)
|
|||
bDumpFlag = true;
|
||||
|
||||
snprintf(filename, sizeof(filename),
|
||||
"%s/logs/sf_dump.log", g_sf_global_vars.base_path);
|
||||
"%s/logs/sf_dump.log", SF_G_BASE_PATH);
|
||||
//manager_dump_global_vars_to_file(filename);
|
||||
|
||||
bDumpFlag = false;
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ int sf_logger_init(LogContext *pContext, const char *filename_prefix)
|
|||
return result;
|
||||
}
|
||||
|
||||
if ((result=log_set_prefix_ex(pContext, g_sf_global_vars.base_path,
|
||||
if ((result=log_set_prefix_ex(pContext, SF_G_BASE_PATH,
|
||||
filename_prefix)) != 0)
|
||||
{
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Reference in New Issue