From bbc7e78e057ef086928523e09537b29c96238c06 Mon Sep 17 00:00:00 2001 From: yuqing Date: Thu, 10 May 2018 17:56:40 +0800 Subject: [PATCH] add sample.conf --- sample.conf | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ src/sf_global.c | 30 +++++++++++++++++++++ src/sf_global.h | 2 ++ 3 files changed, 102 insertions(+) create mode 100644 sample.conf diff --git a/sample.conf b/sample.conf new file mode 100644 index 0000000..9350b34 --- /dev/null +++ b/sample.conf @@ -0,0 +1,70 @@ +# connect timeout in seconds +# default value is 10s +connect_timeout = 2 + +# network timeout in seconds +# default value is 30s +network_timeout = 60 + +# the base path to store data and log files +base_path = /tmp + +# bind an address of this host for inner port +# empty for bind all addresses of this host +inner_bind_addr = + +# bind an address of this host for outer port +# empty for bind all addresses of this host +outer_bind_addr = + +# the internal server port +inner_port = 5607 + +# the outer server port +outer_port = 5608 + +# max concurrent connections this server supported +# default value is 256 +max_connections = 1024 + +# accept thread count +# default value is 1 +accept_threads = 1 + +# work thread count +# default value is 4 +work_threads = 16 + +min_buff_size = 4KB + +max_buff_size = 64KB + +# max pkg size +# default value is 16K +max_pkg_size = 64KB + +# thread stack size, should >= 64KB +# default value is 64KB +thread_stack_size = 256KB + +#unix group name to run this program, +#not set (empty) means run by the group of current user +run_by_group = + +#unix username to run this program, +#not set (empty) means run by current user +run_by_user = + +# sync log buff to disk every interval seconds +# default value is 10 seconds +sync_log_buff_interval = 10 + +# if rotate the error log every day +# default value is false +rotate_error_log = true + +# keep days of the log files +# 0 means do not delete old log files +# default value is 0 +log_file_keep_days = 7 + diff --git a/src/sf_global.c b/src/sf_global.c index 0452759..7604262 100644 --- a/src/sf_global.c +++ b/src/sf_global.c @@ -271,3 +271,33 @@ int sf_load_config(const char *server_name, const char *filename, return 0; } +void sf_log_config() +{ + logInfo("base_path=%s, inner_port=%d, inner_bind_addr=%s, " + "outer_port=%d, outer_bind_addr=%s, " + "max_connections=%d, accept_threads=%d, work_threads=%d, " + "connect_timeout=%d, network_timeout=%d, thread_stack_size=%d, " + "max_pkg_size=%d, min_buff_size=%d, max_buff_size=%d, " + "sync_log_buff_interval=%d, rotate_error_log=%d, " + "log_file_keep_days=%d, run_by_group=%s, run_by_user=%s", + g_sf_global_vars.base_path, + g_sf_global_vars.inner_port, + g_sf_global_vars.inner_bind_addr, + g_sf_global_vars.outer_port, + g_sf_global_vars.outer_bind_addr, + g_sf_global_vars.max_connections, + g_sf_global_vars.accept_threads, + g_sf_global_vars.work_threads, + g_sf_global_vars.connect_timeout, + g_sf_global_vars.network_timeout, + g_sf_global_vars.thread_stack_size, + g_sf_global_vars.max_pkg_size, + g_sf_global_vars.min_buff_size, + g_sf_global_vars.max_buff_size, + g_sf_global_vars.sync_log_buff_interval, + g_sf_global_vars.rotate_error_log, + g_sf_global_vars.log_file_keep_days, + g_sf_global_vars.run_by_group, + g_sf_global_vars.run_by_user + ); +} diff --git a/src/sf_global.h b/src/sf_global.h index e020ef2..3ef25a2 100644 --- a/src/sf_global.h +++ b/src/sf_global.h @@ -57,6 +57,8 @@ int sf_load_config(const char *server_name, const char *filename, IniContext *pIniContext, const int default_inner_port, const int default_outer_port); +void sf_log_config(); + #ifdef __cplusplus } #endif