diff --git a/common/src/tfe_fieldstat.cpp b/common/src/tfe_fieldstat.cpp index 04523af..7527a13 100644 --- a/common/src/tfe_fieldstat.cpp +++ b/common/src/tfe_fieldstat.cpp @@ -8,6 +8,7 @@ void tfe_set_intercept_metric(struct tfe_fieldstat_metric_t *fieldstat, struct session_ctx *s_ctx, int thread_id, int is_session_close) { int ret; + int hit_count = 0; uint16_t out_size; struct tfe_cmsg *cmsg = s_ctx->cmsg; struct timespec current_time; @@ -17,6 +18,16 @@ void tfe_set_intercept_metric(struct tfe_fieldstat_metric_t *fieldstat, struct s return; } + if (s_ctx->metric_hit == 0) { + int flag = 0; + flag = tfe_cmsg_get_flag(cmsg); + if ((flag & TFE_CMSG_FLAG_USER0) == 0) { + return; + } + s_ctx->metric_hit = 1; + hit_count = 1; + } + if (!is_session_close) { clock_gettime(CLOCK_MONOTONIC, ¤t_time); @@ -35,12 +46,6 @@ void tfe_set_intercept_metric(struct tfe_fieldstat_metric_t *fieldstat, struct s int upstream_rx_bytes = s_ctx->s2c_info.rx.n_bytes - s_ctx->s2c_info.rx_send_complete.n_bytes; s_ctx->c2s_info.rx_send_complete = s_ctx->c2s_info.rx; s_ctx->s2c_info.rx_send_complete = s_ctx->s2c_info.rx; - int hit_count = 0; - - if (s_ctx->metric_hit == 0) { - s_ctx->metric_hit = 1; - hit_count = 1; - } int vsys_id = 0; ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_POLICY_VSYS_ID, (unsigned char *)&vsys_id, sizeof(vsys_id), &out_size);