diff options
-rwxr-xr-x | server/server/config.cpp | 8 | ||||
-rwxr-xr-x | server/server/config.h | 21 |
2 files changed, 13 insertions, 16 deletions
diff --git a/server/server/config.cpp b/server/server/config.cpp index 890c369..6d945d3 100755 --- a/server/server/config.cpp +++ b/server/server/config.cpp @@ -31,7 +31,7 @@ void speed_test_thread_func(config *cfg, int check_interval, std::list<config::p { speedtest t(test_url); int sp = (int)t.test(&(*i)); - if(cfg->debug()) + if(cfg->log_speed()) { char port[10]; snprintf(port, 9, "%d", i->port); @@ -71,6 +71,7 @@ void config::load_vars() vars.conn_time = get_int(cfg_str, "ConnectionTimeOut=", 60); vars.dos_conn_count = get_int(cfg_str, "DosConnectionCount=", 100); vars.debug = get_int(cfg_str, "Debug=", 0); + vars.log_speed = get_int(cfg_str, "LogSpeed=", 0); vars.bind_ip = get_string(cfg_str, "BindAddress=", "0.0.0.0"); vars.log_path = get_string(cfg_str, "LogPath=", ""); vars.dos_log_path = get_string(cfg_str, "DosLogPath=", ""); @@ -568,6 +569,11 @@ bool config::ignore_ssl_errors() return vars.ignore_ssl_errors; } +bool config::log_speed() +{ + return vars.log_speed; +} + std::list<std::string>* config::cli_cfg() { return &cvars; diff --git a/server/server/config.h b/server/server/config.h index f19cae1..4afa63d 100755 --- a/server/server/config.h +++ b/server/server/config.h @@ -128,6 +128,7 @@ public: void load_deleted_list(char* pth = NULL); void load_servers_list(char* pth = NULL); bool ignore_ssl_errors(); + bool log_speed(); const std::string& bind_ip(); const std::string& log_path(); const std::string& proxifier_path(); @@ -146,22 +147,12 @@ public: private: struct cfg_data { - int ban_time, conn_count, check_interval, debug, dos_conn_count, conn_time, config_reload_interval, proxy_check_interval; - bool ignore_ssl_errors; + int ban_time, conn_count, check_interval, dos_conn_count, conn_time, config_reload_interval, proxy_check_interval; + bool ignore_ssl_errors, log_speed, debug; std::string log_path, bind_ip, dos_log_path, speed_test_file_url; - cfg_data() - { - ignore_ssl_errors = false; - ban_time = conn_time = 60; - config_reload_interval = 600; - proxy_check_interval = 3600; - conn_count = 30; - check_interval = 30; - debug = 0; - dos_conn_count = 200; - bind_ip = "0.0.0.0"; - speed_test_file_url = "http://google.com"; - } + cfg_data(): ban_time(60), check_interval(30), dos_conn_count(200), conn_time(60), config_reload_interval(600), proxy_check_interval(3600), + ignore_ssl_errors(false), log_speed(false), debug(false) + {} }; std::string config_path, cli_config_path; const int get_int(const std::string& data, const char* var, int default_); |