summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijia <[email protected]>2020-07-27 17:10:07 +0800
committerlijia <[email protected]>2020-07-27 17:10:07 +0800
commit3ae24911c4c96c258d2b16f98457aed5ff026d60 (patch)
treed69f1397c7556fc1cf0af048d434398e22b1eec8
parentbb2effdba527a7ae69753a6a174005a71ff349b9 (diff)
修复关闭polling功能时, CPU占用率100%问题.v4.0.19
-rw-r--r--src/config/config_parse.cpp2
-rw-r--r--src/packet_io/packet_io_marsio.c6
2 files changed, 3 insertions, 5 deletions
diff --git a/src/config/config_parse.cpp b/src/config/config_parse.cpp
index 5ef8b0a..35a2d8c 100644
--- a/src/config/config_parse.cpp
+++ b/src/config/config_parse.cpp
@@ -598,7 +598,7 @@ int sapp_parse_config(void)
tomlc99_wrap_load_string_def(default_config_file, (char *)"packet_io.external.interface", (char *)"type", pconfig->packet_io.external.interface.type_str, NAME_MAX, "pcap");
tomlc99_wrap_load_string_def(default_config_file, (char *)"packet_io.external.interface", (char *)"name", pconfig->packet_io.external.interface.name, NAME_MAX, "lo");
tomlc99_wrap_load_int_def(default_config_file, (char *)"packet_io.polling", (char *)"enabled", &pconfig->packet_io.polling_enabled, 1);
- tomlc99_wrap_load_int_def(default_config_file, (char *)"packet_io.polling", (char *)"polling_priority", &pconfig->packet_io.polling_priority, 10);
+ tomlc99_wrap_load_int_def(default_config_file, (char *)"packet_io.polling", (char *)"polling_priority", &pconfig->packet_io.polling_priority, 100);
/******************************* STREAM ******************************/
tomlc99_wrap_load_string_def(default_config_file, (char *)"STREAM", (char *)"stream_id_base_time", pconfig->stream.stream_id_base_time_str, 32, "");
diff --git a/src/packet_io/packet_io_marsio.c b/src/packet_io/packet_io_marsio.c
index 7df69c7..73750a3 100644
--- a/src/packet_io/packet_io_marsio.c
+++ b/src/packet_io/packet_io_marsio.c
@@ -686,7 +686,7 @@ static void *marsio4_worker(void *arg)
}else{
flush_buf(tid);
/* �ް�ʱҪ����polling�ӿ� */
- if(stream_process_polling(tid) > 0){
+ if((stream_process_polling(tid) & POLLING_STATE_WORK) != 0){
polling_work_times++;
}
}
@@ -695,7 +695,7 @@ static void *marsio4_worker(void *arg)
if((rcv_pkt_tims % sapp_global_val->config.packet_io.polling_priority) == 0){
/* ��������޴�, һֱ�а�ʱ, ÿ��polling_priority����ҲҪ����polling�ӿ� */
- if(stream_process_polling(tid) > 0){
+ if((stream_process_polling(tid) & POLLING_STATE_WORK) != 0){
polling_work_times++;
}
total_call_times++;
@@ -707,8 +707,6 @@ static void *marsio4_worker(void *arg)
rcv_pkt_tims = 0;
polling_work_times = 0;
}
-
-
}
return NULL;