Compare commits
No commits in common. "master" and "V1.2.13" have entirely different histories.
|
|
@ -2,7 +2,7 @@
|
||||||
%define CommitVersion %(echo $COMMIT_VERSION)
|
%define CommitVersion %(echo $COMMIT_VERSION)
|
||||||
|
|
||||||
Name: libserverframe
|
Name: libserverframe
|
||||||
Version: 1.2.15
|
Version: 1.2.13
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: network framework library
|
Summary: network framework library
|
||||||
License: AGPL v3.0
|
License: AGPL v3.0
|
||||||
|
|
@ -12,9 +12,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.88
|
BuildRequires: libfastcommon-devel >= 1.0.85
|
||||||
Requires: %__cp %__mv %__chmod %__grep %__mkdir %__install %__id
|
Requires: %__cp %__mv %__chmod %__grep %__mkdir %__install %__id
|
||||||
Requires: libfastcommon >= 1.0.88
|
Requires: libfastcommon >= 1.0.85
|
||||||
|
|
||||||
%description
|
%description
|
||||||
common framework library
|
common framework library
|
||||||
|
|
|
||||||
|
|
@ -161,9 +161,9 @@ int sf_load_log_config(IniFullContext *ini_ctx, LogContext *log_ctx,
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
log_cfg->sync_log_buff_interval = iniGetTimestampValueEx(
|
log_cfg->sync_log_buff_interval = iniGetIntValueEx(
|
||||||
ini_ctx->section_name, "sync_log_buff_interval",
|
ini_ctx->section_name, "sync_log_buff_interval",
|
||||||
ini_ctx->context, SF_DEF_SYNC_LOG_BUFF_INTERVAL, 1, true);
|
ini_ctx->context, SF_DEF_SYNC_LOG_BUFF_INTERVAL, true);
|
||||||
if (log_cfg->sync_log_buff_interval <= 0) {
|
if (log_cfg->sync_log_buff_interval <= 0) {
|
||||||
log_cfg->sync_log_buff_interval = SF_DEF_SYNC_LOG_BUFF_INTERVAL;
|
log_cfg->sync_log_buff_interval = SF_DEF_SYNC_LOG_BUFF_INTERVAL;
|
||||||
}
|
}
|
||||||
|
|
@ -968,9 +968,6 @@ void sf_context_config_to_string(const SFContext *sf_context,
|
||||||
sock_handler->inner.port, inner_bind_addr,
|
sock_handler->inner.port, inner_bind_addr,
|
||||||
sock_handler->outer.port, outer_bind_addr);
|
sock_handler->outer.port, outer_bind_addr);
|
||||||
}
|
}
|
||||||
if (len >= size) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
len += snprintf(output + len, size - len,
|
len += snprintf(output + len, size - len,
|
||||||
", address_family=%s, accept_threads=%d, work_threads=%d",
|
", address_family=%s, accept_threads=%d, work_threads=%d",
|
||||||
|
|
@ -978,9 +975,6 @@ void sf_context_config_to_string(const SFContext *sf_context,
|
||||||
sf_context->accept_threads, sf_context->work_threads);
|
sf_context->accept_threads, sf_context->work_threads);
|
||||||
|
|
||||||
#if IOEVENT_USE_URING
|
#if IOEVENT_USE_URING
|
||||||
if (len >= size) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
len += snprintf(output + len, size - len, ", use_io_uring=%d, "
|
len += snprintf(output + len, size - len, ", use_io_uring=%d, "
|
||||||
"use_send_zc=%d", sf_context->use_io_uring,
|
"use_send_zc=%d", sf_context->use_io_uring,
|
||||||
sf_context->use_send_zc);
|
sf_context->use_send_zc);
|
||||||
|
|
@ -1036,8 +1030,6 @@ void sf_global_config_to_string_ex(const char *max_pkg_size_item_nm,
|
||||||
int max_buff_size;
|
int max_buff_size;
|
||||||
Version fc_ver;
|
Version fc_ver;
|
||||||
Version sf_ver;
|
Version sf_ver;
|
||||||
int fc_ver_int;
|
|
||||||
int sf_ver_int;
|
|
||||||
char pkg_buff[256];
|
char pkg_buff[256];
|
||||||
|
|
||||||
max_pkg_size = g_sf_global_vars.net_buffer_cfg.max_pkg_size -
|
max_pkg_size = g_sf_global_vars.net_buffer_cfg.max_pkg_size -
|
||||||
|
|
@ -1057,19 +1049,17 @@ void sf_global_config_to_string_ex(const char *max_pkg_size_item_nm,
|
||||||
min_buff_size / 1024, max_buff_size / 1024);
|
min_buff_size / 1024, max_buff_size / 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
fc_ver_int = fc_version(&fc_ver);
|
fc_version(&fc_ver);
|
||||||
sf_ver_int = sf_version(&sf_ver);
|
sf_version(&sf_ver);
|
||||||
len = snprintf(output, size, "libfastcommon version "
|
len = snprintf(output, size, "libfastcommon version "
|
||||||
"{compile: %d.%d.%d %s runtime: %d.%d.%d}, "
|
"{compile: %d.%d.%d, runtime: %d.%d.%d}, "
|
||||||
"libserverframe version "
|
"libserverframe version "
|
||||||
"{compile: %d.%d.%d %s runtime: %d.%d.%d}, "
|
"{compile: %d.%d.%d, runtime: %d.%d.%d}, "
|
||||||
"base_path=%s, max_connections=%d, connect_timeout=%d, "
|
"base_path=%s, max_connections=%d, connect_timeout=%d, "
|
||||||
"network_timeout=%d, thread_stack_size=%d KB, %s, ",
|
"network_timeout=%d, thread_stack_size=%d KB, %s, ",
|
||||||
FC_MAJOR_VERSION, FC_MINOR_VERSION, FC_PATCH_VERSION,
|
FC_MAJOR_VERSION, FC_MINOR_VERSION, FC_PATCH_VERSION,
|
||||||
FC_COMPARE_INT_VERSIONS_TO_OPERATOR_STR(FC_VERSION_INT, fc_ver_int),
|
|
||||||
fc_ver.major, fc_ver.minor, fc_ver.patch,
|
fc_ver.major, fc_ver.minor, fc_ver.patch,
|
||||||
SF_MAJOR_VERSION, SF_MINOR_VERSION, SF_PATCH_VERSION,
|
SF_MAJOR_VERSION, SF_MINOR_VERSION, SF_PATCH_VERSION,
|
||||||
FC_COMPARE_INT_VERSIONS_TO_OPERATOR_STR(SF_VERSION_INT, sf_ver_int),
|
|
||||||
sf_ver.major, sf_ver.minor, sf_ver.patch,
|
sf_ver.major, sf_ver.minor, sf_ver.patch,
|
||||||
SF_G_BASE_PATH_STR,
|
SF_G_BASE_PATH_STR,
|
||||||
g_sf_global_vars.net_buffer_cfg.max_connections,
|
g_sf_global_vars.net_buffer_cfg.max_connections,
|
||||||
|
|
@ -1078,17 +1068,11 @@ void sf_global_config_to_string_ex(const char *max_pkg_size_item_nm,
|
||||||
g_sf_global_vars.thread_stack_size / 1024, pkg_buff);
|
g_sf_global_vars.thread_stack_size / 1024, pkg_buff);
|
||||||
|
|
||||||
#if IOEVENT_USE_URING
|
#if IOEVENT_USE_URING
|
||||||
if (len >= size) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
len += snprintf(output + len, size - len, "use_io_uring=%d, "
|
len += snprintf(output + len, size - len, "use_io_uring=%d, "
|
||||||
"use_send_zc=%d, ", g_sf_context.use_io_uring,
|
"use_send_zc=%d, ", g_sf_context.use_io_uring,
|
||||||
g_sf_context.use_send_zc);
|
g_sf_context.use_send_zc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (len >= size) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
len += snprintf(output + len, size - len,
|
len += snprintf(output + len, size - len,
|
||||||
"tcp_quick_ack=%d, "
|
"tcp_quick_ack=%d, "
|
||||||
"log_level=%s, "
|
"log_level=%s, "
|
||||||
|
|
@ -1097,9 +1081,6 @@ void sf_global_config_to_string_ex(const char *max_pkg_size_item_nm,
|
||||||
log_get_level_caption(),
|
log_get_level_caption(),
|
||||||
g_sf_global_vars.run_by.group,
|
g_sf_global_vars.run_by.group,
|
||||||
g_sf_global_vars.run_by.user);
|
g_sf_global_vars.run_by.user);
|
||||||
if (len >= size) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sf_log_config_to_string(&g_sf_global_vars.error_log,
|
sf_log_config_to_string(&g_sf_global_vars.error_log,
|
||||||
"error-log", output + len, size - len);
|
"error-log", output + len, size - len);
|
||||||
|
|
|
||||||
|
|
@ -641,12 +641,12 @@ int sf_proto_deal_task_done(struct fast_task_info *task,
|
||||||
char time_buff[32];
|
char time_buff[32];
|
||||||
|
|
||||||
if (ctx->log_level != LOG_NOTHING && ctx->response.error.length > 0) {
|
if (ctx->log_level != LOG_NOTHING && ctx->response.error.length > 0) {
|
||||||
format_ip_address(task->client_ip, formatted_ip);
|
|
||||||
log_it_ex(&g_log_context, ctx->log_level,
|
log_it_ex(&g_log_context, ctx->log_level,
|
||||||
"file: "__FILE__", line: %d, %s "
|
"file: "__FILE__", line: %d, %s "
|
||||||
"peer %s:%u, cmd: %d (%s), req body length: %d, "
|
"peer %s:%u, cmd: %d (%s), req body length: %d, "
|
||||||
"resp status: %d, %s", __LINE__, service_name,
|
"resp status: %d, %s", __LINE__, service_name,
|
||||||
formatted_ip, task->port, ctx->request.header.cmd,
|
format_ip_address(task->client_ip, formatted_ip),
|
||||||
|
task->port, ctx->request.header.cmd,
|
||||||
GET_CMD_CAPTION(ctx->request.header.cmd),
|
GET_CMD_CAPTION(ctx->request.header.cmd),
|
||||||
ctx->request.header.body_len, ctx->response.header.status,
|
ctx->request.header.body_len, ctx->response.header.status,
|
||||||
ctx->response.error.message);
|
ctx->response.error.message);
|
||||||
|
|
@ -656,11 +656,11 @@ int sf_proto_deal_task_done(struct fast_task_info *task,
|
||||||
if (sf_handler_ctx.callbacks.get_cmd_log_level != NULL) {
|
if (sf_handler_ctx.callbacks.get_cmd_log_level != NULL) {
|
||||||
time_used = get_current_time_us() - ctx->req_start_time;
|
time_used = get_current_time_us() - ctx->req_start_time;
|
||||||
log_level = GET_CMD_LOG_LEVEL(ctx->request.header.cmd);
|
log_level = GET_CMD_LOG_LEVEL(ctx->request.header.cmd);
|
||||||
format_ip_address(task->client_ip, formatted_ip);
|
|
||||||
log_it_ex(&g_log_context, log_level, "file: "__FILE__", line: %d, "
|
log_it_ex(&g_log_context, log_level, "file: "__FILE__", line: %d, "
|
||||||
"%s client %s:%u, req cmd: %d (%s), req body_len: %d, "
|
"%s client %s:%u, req cmd: %d (%s), req body_len: %d, "
|
||||||
"resp status: %d, time used: %s us", __LINE__, service_name,
|
"resp status: %d, time used: %s us", __LINE__, service_name,
|
||||||
formatted_ip, task->port, ctx->request.header.cmd,
|
format_ip_address(task->client_ip, formatted_ip),
|
||||||
|
task->port, ctx->request.header.cmd,
|
||||||
GET_CMD_CAPTION(ctx->request.header.cmd),
|
GET_CMD_CAPTION(ctx->request.header.cmd),
|
||||||
ctx->request.header.body_len, ctx->response.header.status,
|
ctx->request.header.body_len, ctx->response.header.status,
|
||||||
long_to_comma_str(time_used, time_buff));
|
long_to_comma_str(time_used, time_buff));
|
||||||
|
|
@ -698,12 +698,12 @@ int sf_proto_deal_task_done(struct fast_task_info *task,
|
||||||
char buff[256];
|
char buff[256];
|
||||||
int blen;
|
int blen;
|
||||||
|
|
||||||
format_ip_address(task->client_ip, formatted_ip);
|
|
||||||
blen = sprintf(buff, "timed used: %s us, %s client %s:%u, "
|
blen = sprintf(buff, "timed used: %s us, %s client %s:%u, "
|
||||||
"req cmd: %d (%s), req body len: %d, resp cmd: %d (%s), "
|
"req cmd: %d (%s), req body len: %d, resp cmd: %d (%s), "
|
||||||
"status: %d, resp body len: %d", long_to_comma_str(time_used,
|
"status: %d, resp body len: %d", long_to_comma_str(time_used,
|
||||||
time_buff), service_name, formatted_ip, task->port, ctx->
|
time_buff), service_name, format_ip_address(task->
|
||||||
request.header.cmd, GET_CMD_CAPTION(ctx->request.header.cmd),
|
client_ip, formatted_ip), task->port, ctx->request.
|
||||||
|
header.cmd, GET_CMD_CAPTION(ctx->request.header.cmd),
|
||||||
ctx->request.header.body_len, ctx->response.header.cmd,
|
ctx->request.header.body_len, ctx->response.header.cmd,
|
||||||
GET_CMD_CAPTION(ctx->response.header.cmd),
|
GET_CMD_CAPTION(ctx->response.header.cmd),
|
||||||
ctx->response.header.status, ctx->response.header.body_len);
|
ctx->response.header.status, ctx->response.header.body_len);
|
||||||
|
|
@ -712,12 +712,12 @@ int sf_proto_deal_task_done(struct fast_task_info *task,
|
||||||
|
|
||||||
if (sf_handler_ctx.callbacks.get_cmd_log_level != NULL) {
|
if (sf_handler_ctx.callbacks.get_cmd_log_level != NULL) {
|
||||||
log_level = GET_CMD_LOG_LEVEL(ctx->request.header.cmd);
|
log_level = GET_CMD_LOG_LEVEL(ctx->request.header.cmd);
|
||||||
format_ip_address(task->client_ip, formatted_ip);
|
|
||||||
log_it_ex(&g_log_context, log_level, "file: "__FILE__", line: %d, "
|
log_it_ex(&g_log_context, log_level, "file: "__FILE__", line: %d, "
|
||||||
"%s client %s:%u, req cmd: %d (%s), req body_len: %d, "
|
"%s client %s:%u, req cmd: %d (%s), req body_len: %d, "
|
||||||
"resp cmd: %d (%s), status: %d, resp body_len: %d, "
|
"resp cmd: %d (%s), status: %d, resp body_len: %d, "
|
||||||
"time used: %s us", __LINE__, service_name,
|
"time used: %s us", __LINE__, service_name,
|
||||||
formatted_ip, task->port, ctx->request.header.cmd,
|
format_ip_address(task->client_ip, formatted_ip),
|
||||||
|
task->port, ctx->request.header.cmd,
|
||||||
GET_CMD_CAPTION(ctx->request.header.cmd),
|
GET_CMD_CAPTION(ctx->request.header.cmd),
|
||||||
ctx->request.header.body_len, ctx->response.header.cmd,
|
ctx->request.header.body_len, ctx->response.header.cmd,
|
||||||
GET_CMD_CAPTION(ctx->response.header.cmd),
|
GET_CMD_CAPTION(ctx->response.header.cmd),
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ int sf_printbuffer(char* buffer,int32_t len)
|
||||||
void sf_usage_ex(const char *program, const SFCMDOption *other_options)
|
void sf_usage_ex(const char *program, const SFCMDOption *other_options)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\nUsage: %s [options] <config_file> "
|
fprintf(stderr, "\nUsage: %s [options] <config_file> "
|
||||||
"[start | stop | restart | status]\n\nOptions:\n", program);
|
"[start | stop | restart | status]\n\noptions:\n", program);
|
||||||
|
|
||||||
if (other_options != NULL) {
|
if (other_options != NULL) {
|
||||||
const SFCMDOption *option;
|
const SFCMDOption *option;
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,9 @@
|
||||||
|
|
||||||
#include "sf_version.h"
|
#include "sf_version.h"
|
||||||
|
|
||||||
int sf_version(Version *version)
|
void sf_version(Version *version)
|
||||||
{
|
{
|
||||||
version->major = SF_MAJOR_VERSION;
|
version->major = SF_MAJOR_VERSION;
|
||||||
version->minor = SF_MINOR_VERSION;
|
version->minor = SF_MINOR_VERSION;
|
||||||
version->patch = SF_PATCH_VERSION;
|
version->patch = SF_PATCH_VERSION;
|
||||||
return FC_VERSION_TO_INT1(*version);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,13 @@
|
||||||
|
|
||||||
#define SF_MAJOR_VERSION 1
|
#define SF_MAJOR_VERSION 1
|
||||||
#define SF_MINOR_VERSION 2
|
#define SF_MINOR_VERSION 2
|
||||||
#define SF_PATCH_VERSION 15
|
#define SF_PATCH_VERSION 13
|
||||||
|
|
||||||
#define SF_VERSION_INT FC_VERSION_TO_INT(SF_MAJOR_VERSION, \
|
|
||||||
SF_MINOR_VERSION, SF_PATCH_VERSION)
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int sf_version(Version *version);
|
void sf_version(Version *version);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue