upgrade version to V1.1.8
parent
02eaad6a89
commit
561b7c8d7c
|
|
@ -3,7 +3,7 @@
|
||||||
%define CommitVersion %(echo $COMMIT_VERSION)
|
%define CommitVersion %(echo $COMMIT_VERSION)
|
||||||
|
|
||||||
Name: libserverframe
|
Name: libserverframe
|
||||||
Version: 1.1.7
|
Version: 1.1.8
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: network framework library
|
Summary: network framework library
|
||||||
License: AGPL v3.0
|
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)
|
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: %__cp %__mv %__chmod %__grep %__mkdir %__install %__id
|
||||||
Requires: libfastcommon >= 1.0.50
|
Requires: libfastcommon >= 1.0.51
|
||||||
|
|
||||||
%description
|
%description
|
||||||
common framework library
|
common framework library
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@
|
||||||
|
|
||||||
SFGlobalVariables g_sf_global_vars = {
|
SFGlobalVariables g_sf_global_vars = {
|
||||||
DEFAULT_CONNECT_TIMEOUT, DEFAULT_NETWORK_TIMEOUT,
|
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_PACKAGE_SIZE, SF_DEF_MIN_BUFF_SIZE,
|
||||||
SF_DEF_MAX_BUFF_SIZE, 0, SF_DEF_THREAD_STACK_SIZE,
|
SF_DEF_MAX_BUFF_SIZE, 0, SF_DEF_THREAD_STACK_SIZE,
|
||||||
0, 0, 0, {'\0'}, {'\0'}, {SF_DEF_SYNC_LOG_BUFF_INTERVAL, false},
|
0, 0, 0, {'\0'}, {'\0'}, {SF_DEF_SYNC_LOG_BUFF_INTERVAL, false},
|
||||||
|
|
@ -227,27 +228,29 @@ int sf_load_global_config_ex(const char *server_name,
|
||||||
char *pRunByUser;
|
char *pRunByUser;
|
||||||
|
|
||||||
g_sf_global_vars.task_buffer_extra_size = task_buffer_extra_size;
|
g_sf_global_vars.task_buffer_extra_size = task_buffer_extra_size;
|
||||||
pBasePath = iniGetStrValue(NULL, "base_path", ini_ctx->context);
|
if (!g_sf_global_vars.base_path.inited) {
|
||||||
if (pBasePath == NULL) {
|
pBasePath = iniGetStrValue(NULL, "base_path", ini_ctx->context);
|
||||||
logError("file: "__FILE__", line: %d, "
|
if (pBasePath == NULL) {
|
||||||
"conf file \"%s\" must have item "
|
logError("file: "__FILE__", line: %d, "
|
||||||
"\"base_path\"!", __LINE__, ini_ctx->filename);
|
"conf file \"%s\" must have item "
|
||||||
return ENOENT;
|
"\"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),
|
chopPath(SF_G_BASE_PATH);
|
||||||
"%s", pBasePath);
|
if (!fileExists(SF_G_BASE_PATH)) {
|
||||||
chopPath(g_sf_global_vars.base_path);
|
|
||||||
if (!fileExists(g_sf_global_vars.base_path)) {
|
|
||||||
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__, g_sf_global_vars.base_path, strerror(errno));
|
__LINE__, SF_G_BASE_PATH, strerror(errno));
|
||||||
return errno != 0 ? errno : ENOENT;
|
return errno != 0 ? errno : ENOENT;
|
||||||
}
|
}
|
||||||
if (!isDir(g_sf_global_vars.base_path)) {
|
if (!isDir(SF_G_BASE_PATH)) {
|
||||||
logError("file: "__FILE__", line: %d, "
|
logError("file: "__FILE__", line: %d, "
|
||||||
"\"%s\" is not a directory!",
|
"\"%s\" is not a directory!",
|
||||||
__LINE__, g_sf_global_vars.base_path);
|
__LINE__, SF_G_BASE_PATH);
|
||||||
return ENOTDIR;
|
return ENOTDIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -338,7 +341,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(g_sf_global_vars.base_path, server_name)) != 0) {
|
if ((result=log_set_prefix(SF_G_BASE_PATH, server_name)) != 0) {
|
||||||
return result;
|
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, "
|
"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, ",
|
"run_by_group=%s, run_by_user=%s, ", SF_G_BASE_PATH,
|
||||||
g_sf_global_vars.base_path,
|
|
||||||
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,
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,10 @@ typedef struct sf_connection_stat {
|
||||||
typedef struct sf_global_variables {
|
typedef struct sf_global_variables {
|
||||||
int connect_timeout;
|
int connect_timeout;
|
||||||
int network_timeout;
|
int network_timeout;
|
||||||
char base_path[MAX_PATH_SIZE];
|
struct {
|
||||||
|
char str[MAX_PATH_SIZE];
|
||||||
|
bool inited;
|
||||||
|
} base_path;
|
||||||
|
|
||||||
volatile bool continue_flag;
|
volatile bool continue_flag;
|
||||||
bool tcp_quick_ack;
|
bool tcp_quick_ack;
|
||||||
|
|
@ -67,7 +70,7 @@ 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
|
#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_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
|
||||||
|
|
|
||||||
|
|
@ -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", g_sf_global_vars.base_path);
|
"%s/logs/sf_dump.log", SF_G_BASE_PATH);
|
||||||
//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, g_sf_global_vars.base_path,
|
if ((result=log_set_prefix_ex(pContext, SF_G_BASE_PATH,
|
||||||
filename_prefix)) != 0)
|
filename_prefix)) != 0)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue