diff options
| -rw-r--r-- | lirenjie_vxlan_sapp_20200803.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/lirenjie_vxlan_sapp_20200803.c b/lirenjie_vxlan_sapp_20200803.c index 9bb1f59..7a49508 100644 --- a/lirenjie_vxlan_sapp_20200803.c +++ b/lirenjie_vxlan_sapp_20200803.c @@ -19,6 +19,7 @@ #include "stream.h" #include "rdkafka.h" #include "libGSJ.h" +#include "cJSON.h" int version_20190827_1605; @@ -90,7 +91,7 @@ pthread_t GSJ_Work; pthread_t count; //timer thread pthread_t timer; -int time_out = 0; //1:time out,push data +int time_out[32] = {0}; //1:time out,push data struct traffic_info { @@ -691,7 +692,7 @@ char TCP_ENTRY_ALL(struct streaminfo *pstream, void **pme, int thread_seq, const //printf("TCP_ENTRY_ALL SUCCESS!!!\n"); struct tcpdetail *raw_pdetail = (struct tcpdetail *)pstream->pdetail; struct traffic_info *tinfo; - + #if ENABLE_COUNT_THREAD all_stream_pkt_num[thread_seq]++; #endif @@ -747,7 +748,7 @@ char TCP_ENTRY_ALL(struct streaminfo *pstream, void **pme, int thread_seq, const *pme = tinfo; } tinfo = (struct traffic_info *)(*pme); - + if (pstream->pktstate == OP_STATE_CLOSE) { if (tcp_flow_id != -1) @@ -778,14 +779,14 @@ char TCP_ENTRY_ALL(struct streaminfo *pstream, void **pme, int thread_seq, const print_traffic_info(tinfo, pstream); free(tinfo); - + return DEFAULT_RETURN_VALUE; } /*每隔N秒发一次 */ if (pstream->pktstate == OP_STATE_DATA) { - if (time_out) + if (time_out[thread_seq]) { if (tcp_flow_id != -1) { @@ -804,7 +805,7 @@ char TCP_ENTRY_ALL(struct streaminfo *pstream, void **pme, int thread_seq, const } /* layer_addr */ tinfo->addr = pstream->addr; - + gettimeofday(&tinfo->stat_time, NULL); #if ENABLE_COUNT_THREAD @@ -822,6 +823,7 @@ char TCP_ENTRY_ALL(struct streaminfo *pstream, void **pme, int thread_seq, const tinfo->C2S_bytes = tflow->C2S_all_byte; tinfo->S2C_bytes = tflow->S2C_all_byte; } + time_out[thread_seq] = 0; } } @@ -835,7 +837,6 @@ error_drop: return APP_STATE_DROPME | APP_STATE_DROPPKT; } - char TCP_ENTRY(struct streaminfo *pstream, void **pme, int thread_seq, const void *raw_pkt) { struct tcpdetail *raw_pdetail = (struct tcpdetail *)pstream->pdetail; @@ -988,7 +989,7 @@ char TCP_ENTRY(struct streaminfo *pstream, void **pme, int thread_seq, const voi // time_new = (time_t *)calloc(1, sizeof(time_t)); // time(time_new); // if (*time_new - *time_old >= 120) - if (time_out) + if (time_out[thread_seq]) { if (tcp_flow_id != -1) { @@ -1030,6 +1031,7 @@ char TCP_ENTRY(struct streaminfo *pstream, void **pme, int thread_seq, const voi } // free(time_new); // time(time_old); + time_out[thread_seq] = 0; } // free(time_new); } @@ -1228,7 +1230,7 @@ char UDP_ENTRY(struct streaminfo *pstream, void **pme, int thread_seq, const voi // time_new = (time_t *)calloc(1, sizeof(time_t)); // time(time_new); // if (*time_new - *time_old >= 120) - if (time_out) + if (time_out[thread_seq]) { if (udp_flow_id != -1) { @@ -1268,10 +1270,9 @@ char UDP_ENTRY(struct streaminfo *pstream, void **pme, int thread_seq, const voi tinfo->C2S_bytes = tflow->C2S_byte; tinfo->S2C_bytes = tflow->S2C_byte; } - // free(time_new); - // time(time_old); + time_out[thread_seq] = 0; } // free(time_new); @@ -1323,13 +1324,13 @@ void timer_work() while (1) { sleep(120); - if (!time_out) - { - time_out = 1; - } - else + int i = 0; + for (i; i < 32; i++) { - time_out = 0; + if (!time_out[i]) + { + time_out[i] = 1; + } } } } |
