修复笔误,流量统计数组下标使用错误导致统计异常
This commit is contained in:
@@ -34,7 +34,7 @@ static __attribute__((__used__)) const char * GIT_VERSION_UNKNOWN = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
char TSG_MASTER_VERSION_20191224=0;
|
||||
char TSG_MASTER_VERSION_20191226=0;
|
||||
const char *tsg_conffile="tsgconf/main.conf";
|
||||
g_tsg_para_t g_tsg_para;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ int tsg_set_policy_flow(struct streaminfo *a_stream, Maat_rule_t *p_result, int
|
||||
return -1;
|
||||
}
|
||||
|
||||
traffic_info=&g_tsg_statis_para.traffic_info[thread_seq][(int)p_result->action];
|
||||
traffic_info=&(g_tsg_statis_para.traffic_info[(int)p_result->action][thread_seq]);
|
||||
|
||||
traffic_info->con_num++;
|
||||
traffic_info->in_bytes+=a_stream->ptcpdetail->clientbytes;
|
||||
@@ -204,14 +204,6 @@ int tsg_statistic_init(const char *conffile, void *logger)
|
||||
|
||||
memset(&g_tsg_statis_para, 0, sizeof(g_tsg_statis_para));
|
||||
|
||||
MESA_load_profile_int_def(conffile, "STATISTIC", "CYCLE", &g_tsg_statis_para.cycle, 30);
|
||||
if(g_tsg_statis_para.cycle<=0)
|
||||
{
|
||||
MESA_handle_runtime_log(logger, RLOG_LV_FATAL, "STATISTIC", "Disabale traffic statistic");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
thread_num=get_thread_count();
|
||||
for(i=0; i<TSG_ACTION_MAX; i++)
|
||||
{
|
||||
@@ -219,6 +211,12 @@ int tsg_statistic_init(const char *conffile, void *logger)
|
||||
}
|
||||
|
||||
MESA_load_profile_int_def(conffile, "STATISTIC", "CYCLE", &g_tsg_statis_para.cycle, 30);
|
||||
if(g_tsg_statis_para.cycle<=0)
|
||||
{
|
||||
MESA_handle_runtime_log(logger, RLOG_LV_FATAL, "STATISTIC", "Disabale traffic statistic");
|
||||
return 0;
|
||||
}
|
||||
|
||||
MESA_load_profile_short_nodef(conffile, "STATISTIC", "TELEGRAF_PORT", (short *)&(fs_server_port));
|
||||
MESA_load_profile_string_nodef(conffile,"STATISTIC", "TELEGRAF_IP",fs_server_ip, sizeof(fs_server_ip));
|
||||
MESA_load_profile_string_def(conffile,"STATISTIC", "OUTPUT_PATH",fs_output_path, sizeof(fs_output_path), "statistic.log");
|
||||
|
||||
Reference in New Issue
Block a user