diff options
| author | yangwei <[email protected]> | 2024-09-13 16:00:51 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2024-09-13 16:04:50 +0800 |
| commit | 16ed95c283a1cced12945b95c501db94008b3320 (patch) | |
| tree | b1adeba015769dafbd56dd9d3256c66d581d28ac | |
| parent | a9bc2b4782a448c68f9529da628e6e552844f47f (diff) | |
🧪 test(dumpfile polling): add polling timing for dumpfile
| -rw-r--r-- | module_test/src/gtest_sapp_comm.cpp | 1 | ||||
| -rw-r--r-- | module_test/src/gtest_sapp_ipv4_plug.cpp | 7 | ||||
| -rw-r--r-- | module_test/src/gtest_sapp_support.cpp | 131 | ||||
| -rw-r--r-- | module_test/src/gtest_sapp_udp.cpp | 1 | ||||
| -rw-r--r-- | src/packet_io/packet_io_pcap.c | 5 |
5 files changed, 80 insertions, 65 deletions
diff --git a/module_test/src/gtest_sapp_comm.cpp b/module_test/src/gtest_sapp_comm.cpp index 163e132..6fe2062 100644 --- a/module_test/src/gtest_sapp_comm.cpp +++ b/module_test/src/gtest_sapp_comm.cpp @@ -616,6 +616,7 @@ void set_default_config(void) update_config_file("etc/sapp.toml", "timeout", "999"); update_config_file("etc/sapp.toml", "interval", "1"); update_config_file("etc/sapp.toml", "dumpfile_sleep_time_before_exit", "0"); + update_config_file("etc/sapp.toml", "watchdog_enabled", "0"); update_config_file("etc/sapp.toml", "overlay_mode", "none"); update_config_file_by_lastline("etc/sapp.toml", "packet_io.deployment", "mode", "mirror"); update_config_file_by_lastline("etc/sapp.toml", "tools.pkt_dump", "enabled", "0"); /* 默认关闭捕包功能, 特殊测试用例单独打开 */ diff --git a/module_test/src/gtest_sapp_ipv4_plug.cpp b/module_test/src/gtest_sapp_ipv4_plug.cpp index 63800ce..9937aa9 100644 --- a/module_test/src/gtest_sapp_ipv4_plug.cpp +++ b/module_test/src/gtest_sapp_ipv4_plug.cpp @@ -147,3 +147,10 @@ extern "C" char iplayer_readjust_time_entry(const struct streaminfo *pstream, un g_current_time = g_current_time_ms / 1000; return APP_STATE_GIVEME; } + +extern "C" char timer_add_1s_polling_entry(struct streaminfo *stream , void **pme , int thread_seq ,void *a_packet ) +{ + if(g_current_time_ms >= 0)g_current_time_ms+=1000; + return POLLING_STATE_IDLE; +} + diff --git a/module_test/src/gtest_sapp_support.cpp b/module_test/src/gtest_sapp_support.cpp index f4f6a75..263ba39 100644 --- a/module_test/src/gtest_sapp_support.cpp +++ b/module_test/src/gtest_sapp_support.cpp @@ -21,7 +21,7 @@ void control_max_unorder_run(void) { set_default_config(); #if SAPP_V3 - update_config_file("conf/main.conf", "MaxUnorderNum", "3"); /* ȫ�����������С��ʵ������İ����, �ᵼ����Ϊ�Ƕ��� */ + update_config_file("conf/main.conf", "MaxUnorderNum", "3"); /* ȫ�����������С��ʵ������İ����, �ᵼ����Ϊ�Ƕ��� */ #elif SAPP_V4 update_config_file("etc/sapp.toml", "reorder_pkt_max", "3"); #else @@ -81,6 +81,7 @@ void control_timeout_run(void) #endif update_plugin_inf("IP", "iplayer_readjust_time_entry"); append_plugin_inf("TCP", "ctrl_tcp_timeout_entry"); + append_plugin_inf("POLLING", "timer_add_1s_polling_entry"); set_pcap_dumpfile("tcp/tcp_timeout_reset.pcap"); @@ -200,7 +201,7 @@ void control_tunnel_type_l2tp_run(void) { set_default_config(); - /* l2tpʶ��Ŀǰ��Ҫ����l2tp_protocol��� */ + /* l2tpʶ��Ŀǰ��Ҫ����l2tp_protocol��� */ insert_into_conflist_inf("protocol", "./plug/protocol/l2tp_protocol_plug/l2tp_protocol_plug.inf"); update_plugin_inf("TCP", "ctrl_tunnel_l2tp_entry"); @@ -230,7 +231,7 @@ void control_tunnel_type_gtp_run(void) set_default_config(); #if SAPP_V3 - update_config_file("conf/main.conf", "CreatLinkMode", "3"); /* gtp_simple.pcapû��syn�� */ + update_config_file("conf/main.conf", "CreatLinkMode", "3"); /* gtp_simple.pcapû��syn�� */ #elif SAPP_V4 update_config_file("etc/sapp.toml", "syn_mandatory", "0"); #else @@ -244,7 +245,7 @@ void control_tunnel_type_gtp_run(void) call_libsapp_devel_with_args(2, sapp_start_args); } -/* ����sapp_get_platform_opt()�ӿ���ع��� */ +/* ����sapp_get_platform_opt()�ӿ���ع��� */ void control_stream_and_traffic_run(void) { set_default_config(); @@ -272,7 +273,7 @@ void project_simple_run(void) { set_default_config(); - /* ����gtest.inf */ + /* ����gtest.inf */ update_plugin_inf_with_options("./plug/business/gtest_sapp", "gtest", "project_test_init", NULL, "TCP", "project_customer_entry"); append_plugin_inf("TCP_ALL", "project_producer_entry"); @@ -293,18 +294,18 @@ void project_simple_run(void) call_libsapp_devel_with_args(2, sapp_start_args); } -#if 0 //��bridge�ӿڴ��� +#if 0 //��bridge�ӿڴ��� void project_nodify_run(void) { set_default_config(); - /* ����gtest.inf */ + /* ����gtest.inf */ update_plugin_inf_with_options("./plug/business/gtest_sapp", "gtest", "project_test_init", NULL, "TCP", "project_customer_entry"); - /* project_producer_notify_entry ע�ᵽTCP_ALL, ��֤Ҫ����TCP�������, �Ȳ���projectֵ */ + /* project_producer_notify_entry ע�ᵽTCP_ALL, ��֤Ҫ����TCP�������, �Ȳ���projectֵ */ append_plugin_inf("TCP_ALL", "project_producer_notify_entry"); - /* ����sapp_appstate���������IJ��Ŀ¼, ��������project nofity���� */ + /* ����sapp_appstate���������IJ��Ŀ¼, ��������project nofity���� */ update_plugin_inf_with_options("./plug/business/gtest_sapp_appstate_1", "notify1", "project_nofity_custom1_init", NULL, "TCP", "project_customer_entry1"); update_plugin_inf_with_options("./plug/business/gtest_sapp_appstate_2", "notify2", "project_nofity_custom2_init", NULL, "TCP", "project_customer_entry2"); @@ -349,8 +350,8 @@ void timer_simple_run(void) update_plugin_inf("TCP_ALL", "timer_tcpall_entry"); /* - ����һ��pcap��, ʹ�����dz���, ʹ��--dumpfile-speed=timestamp����,��֤ƽ̨��ʱ�䲻�˳�! - �����pcap_onlineģʽ����lo��,�dz�����û������,���²�����ᱻ����. + ����һ��pcap��, ʹ�����dz���, ʹ��--dumpfile-speed=timestamp����,��֤ƽ̨��ʱ�䲻�˳�! + �����pcap_onlineģʽ����lo��,�dz�����û������,���²�����ᱻ����. */ set_pcap_dumpfile("for_gtest_only/timer/timer_tcp_test.pcap"); ASSERT_EQ(file_md5_checksum("dumpfile", "7bfc59d66bb44f76603cd6cedfd19091"),0); @@ -369,7 +370,7 @@ void timer_simple_run(void) while(sapp_get_current_state() != SAPP_STATE_PROCESSING){ usleep(10); } - /* ע��: �˴���Ҫ�������sleep() 10������!! */ + /* ע��: �˴���Ҫ�������sleep() 10������!! */ sleep(12); libsapp_destroy_env(); @@ -420,7 +421,7 @@ void global_stream_id_tuple4_reuse_run(void) } /* - ������Ԫ�����ú�, ���Ĵ���ʱ���Ƿ����. + ������Ԫ�����ú�, ���Ĵ���ʱ���Ƿ����. */ void stream_creattime_tuple4_reuse_run(void) { @@ -488,7 +489,7 @@ void control_platform_opt_run(void) { set_default_config(); - /* ����gtest.inf, �˴���Ҫ�Ǹ���test_get_platform_opt_init()����, �����ʵ����ν, ���Ӹ�tcp��� */ + /* ����gtest.inf, �˴���Ҫ�Ǹ���test_get_platform_opt_init()����, �����ʵ����ν, ���Ӹ�tcp��� */ update_plugin_inf_with_options("./plug/business/gtest_sapp", "gtest", "test_get_platform_opt_init", NULL, "TCP", "tcp_simple"); set_pcap_dumpfile("tcp/tcp_simple.pcap"); @@ -518,12 +519,12 @@ void control_stream_create_timestamp_ms_run(void) } -/* ���Ի�ȡ��ǰ���ϲ���ص�����, ��ײ�������ͬ */ +/* ���Ի�ȡ��ǰ���ϲ���ص�����, ��ײ�������ͬ */ void control_up_layer_tunnel_gtp_run(void) { set_default_config(); - /* gtp_dns.pcap�м����ظ����ݰ�, �ùر��ظ������� */ + /* gtp_dns.pcap�м����ظ����ݰ�, �ùر��ظ������� */ update_config_file("etc/sapp.toml", "original_ipv4_udp_enabled", "0"); update_config_file("etc/sapp.toml", "inject_all_enabled", "0"); @@ -537,12 +538,12 @@ void control_up_layer_tunnel_gtp_run(void) } -/* ���Ի�ȡ��ǰ���ϲ���ص�����, ��ײ�������ͬ */ +/* ���Ի�ȡ��ǰ���ϲ���ص�����, ��ײ�������ͬ */ void control_up_layer_tunnel_l2tp_run(void) { set_default_config(); - /* l2tpʶ��Ŀǰ��Ҫ����l2tp_protocol��� */ + /* l2tpʶ��Ŀǰ��Ҫ����l2tp_protocol��� */ insert_into_conflist_inf("protocol", "./plug/protocol/l2tp_protocol_plug/l2tp_protocol_plug.inf"); update_plugin_inf("UDP", "up_layer_tunnel_l2tp_entry"); @@ -555,7 +556,7 @@ void control_up_layer_tunnel_l2tp_run(void) } -/* ���Ի�ȡ��ǰ���ϲ���ص�����, ��ײ�������ͬ */ +/* ���Ի�ȡ��ǰ���ϲ���ص�����, ��ײ�������ͬ */ void control_up_layer_tunnel_teredo_run(void) { set_default_config(); @@ -570,20 +571,20 @@ void control_up_layer_tunnel_teredo_run(void) } -/* ���Բ����pme */ +/* ���Բ����pme */ void control_get_plug_pme_run(void) { set_default_config(); - update_plugin_inf("TCP", "void_entry"); /* �˲����Ҫ���ڵ��� gtest_sapp_slave_init, entry����ɶҲ���� */ + update_plugin_inf("TCP", "void_entry"); /* �˲����Ҫ���ڵ��� gtest_sapp_slave_init, entry����ɶҲ���� */ update_plugin_inf_with_options("./plug/business/gtest_get_plug_pme1", "get_plug_pme1", "get_plug_pme_init", NULL, "TCP_ALL", "get_plug_pme_tcpall_entry"); update_plugin_inf_with_options("./plug/business/gtest_get_plug_pme2", "get_plug_pme2", "get_plug_pme_init", NULL, "TCP", "get_plug_pme_tcp_entry"); - /* ��Ҫע��: - sapp����business�����dlopen + RTLD_LOCAL����ģʽ, ������-l��ϵͳ�Զ����ص�, - ������ͬ�������ں���������Ȼһ��, ���ڴ��ַʵ���Dz�һ����!! - ������Ҫ���ص�platform��. + /* ��Ҫע��: + sapp����business�����dlopen + RTLD_LOCAL����ģʽ, ������-l��ϵͳ�Զ����ص�, + ������ͬ�������ں���������Ȼһ��, ���ڴ��ַʵ���Dz�һ����!! + ������Ҫ���ص�platform��. */ update_plugin_inf_with_options("./plug/platform/gtest_get_plug_pme3", "get_plug_pme3", "get_plug_pme_init", NULL, "UDP", "get_plug_pme_udp_entry1"); update_plugin_inf_with_options("./plug/platform/gtest_get_plug_pme4", "get_plug_pme4", "get_plug_pme_init", NULL, "UDP", "get_plug_pme_udp_entry2"); @@ -608,12 +609,12 @@ void control_get_plug_pme_run(void) } -/* ���Ա�Ҫ����ij�ʼ��, ���.inf��.so������, init()�������ش��� */ +/* ���Ա�Ҫ����ij�ʼ��, ���.inf��.so������, init()�������ش��� */ void control_plug_necessary_run(void) { set_default_config(); - /* Ĭ�Ͻ���dzɹ�, ���Dz�����ʹ����� */ + /* Ĭ�Ͻ���dzɹ�, ���Dz�����ʹ����� */ gtest_set_timeout_default_result(GTEST_SAPP_SUCC); update_plugin_inf_with_options("./plug/business/necessary", "plug_necessary", "plug_necessary_init", NULL, "TCP", "plug_necessary_not_call_entry"); @@ -633,12 +634,12 @@ void control_plug_necessary_run(void) call_libsapp_devel_with_args(2, sapp_start_args); } -/* ���Ա�Ҫ����ij�ʼ��,���Dz��.inf������, ��ȡ���.so·��, �����������Ȼ���ִ��� */ +/* ���Ա�Ҫ����ij�ʼ��,���Dz��.inf������, ��ȡ���.so·��, �����������Ȼ���ִ��� */ void control_plug_necessary_run_no_inf(void) { set_default_config(); - /* Ĭ�Ͻ���dzɹ�, ���Dz�����ʹ����� */ + /* Ĭ�Ͻ���dzɹ�, ���Dz�����ʹ����� */ gtest_set_timeout_default_result(GTEST_SAPP_SUCC); update_plugin_inf_with_options("./plug/business/necessary", "plug_necessary", "plug_necessary_init", NULL, "TCP", "plug_necessary_not_call_entry"); @@ -647,7 +648,7 @@ void control_plug_necessary_run_no_inf(void) append_conflist_inf("./plug/business/necessary/gtest_sapp.inf"); append_conflist_inf("./plug/business/indifferent/gtest_sapp.inf"); - system("rm -f ./plug/business/necessary/gtest_sapp.inf"); /* ����ɾ��necessary��.inf�ļ� */ + system("rm -f ./plug/business/necessary/gtest_sapp.inf"); /* ����ɾ��necessary��.inf�ļ� */ set_pcap_dumpfile("tcp/tcp_simple.pcap"); ASSERT_EQ(file_md5_checksum("dumpfile", "df138740a6a22ca9c977052f21f7a470"),0); @@ -658,12 +659,12 @@ void control_plug_necessary_run_no_inf(void) } -/* ���Ա�Ҫ����ij�ʼ��,���.inf����, ����.so������, dlopen����ִ��� */ +/* ���Ա�Ҫ����ij�ʼ��,���.inf����, ����.so������, dlopen����ִ��� */ void control_plug_necessary_run_no_sofile(void) { set_default_config(); - /* Ĭ�Ͻ���dzɹ�, ���Dz�����ʹ����� */ + /* Ĭ�Ͻ���dzɹ�, ���Dz�����ʹ����� */ gtest_set_timeout_default_result(GTEST_SAPP_SUCC); update_plugin_inf_with_options("./plug/business/necessary", "plug_necessary", "plug_necessary_init", NULL, "TCP", "plug_necessary_not_call_entry"); @@ -672,7 +673,7 @@ void control_plug_necessary_run_no_sofile(void) append_conflist_inf("./plug/business/necessary/gtest_sapp.inf"); append_conflist_inf("./plug/business/indifferent/gtest_sapp.inf"); - system("rm -f ./plug/business/necessary/libgtest_sapp.so"); /* ����ɾ��necessary��.so�ļ� */ + system("rm -f ./plug/business/necessary/libgtest_sapp.so"); /* ����ɾ��necessary��.so�ļ� */ system("cp -f ./plug/business/gtest_sapp/libgtest_sapp.so ./plug/business/indifferent/"); set_pcap_dumpfile("tcp/tcp_simple.pcap"); @@ -684,7 +685,7 @@ void control_plug_necessary_run_no_sofile(void) } -/* ���Բ����ȡ�ظ�����״̬, tcp�� */ +/* ���Բ����ȡ�ظ�����״̬, tcp�� */ void control_plug_dup_pkt_tcp_run(void) { set_default_config(); @@ -705,7 +706,7 @@ void control_plug_dup_pkt_tcp_run(void) } -/* ���Բ����ȡ�ظ�����״̬, udp�� */ +/* ���Բ����ȡ�ظ�����״̬, udp�� */ void control_plug_dup_pkt_udp_run(void) { set_default_config(); @@ -725,7 +726,7 @@ void control_plug_dup_pkt_udp_run(void) } /* - ͨ�������в���-c�������ļ���Ŀ¼, -D�������ļ���Ŀ¼��IJ���. + ͨ�������в���-c�������ļ���Ŀ¼, -D�������ļ���Ŀ¼��IJ���. */ void control_get_root_dir_run(void) { @@ -754,9 +755,9 @@ void control_get_root_dir_run(void) update_config_file("./etc/sapp.toml", "dumpfile_sleep_time_before_exit", "0"); - /* ��Ϊ�����ļ�·�������'/', ���sed�����ͻ, ��Ҫʹ�ö���ת��, - ��һ��������������\\, ��ʾ��ʵ��'\', - �ڶ���ת�����ʵ�����\x2F, ����sed��˵��ʾ��ʵ��'/' + /* ��Ϊ�����ļ�·�������'/', ���sed�����ͻ, ��Ҫʹ�ö���ת��, + ��һ��������������\\, ��ʾ��ʵ��'\', + �ڶ���ת�����ʵ�����\x2F, ����sed��˵��ʾ��ʵ��'/' */ update_config_file("./etc/sapp.toml", "cfg_file_sapp_log", "\\x22\\x2Ftmp\\x2Fsapp_change_root_dir_test\\x2Fconfig\\x2Fetc\\x2Fsapp_log.conf\\x22"); update_config_file("./etc/sapp.toml", "cfg_file_plug_list", "\\x22\\x2Ftmp\\x2Fsapp_change_root_dir_test\\x2Fconfig\\x2Fplug\\x2Fconflist.inf\\x22"); @@ -767,7 +768,7 @@ void control_get_root_dir_run(void) update_plugin_inf("TCP", "ctrl_get_root_dir_entry"); - /* ������Ĭ�ϲ�����, �ٽ���copy��ָ������Ŀ¼�� */ + /* ������Ĭ�ϲ�����, �ٽ���copy��ָ������Ŀ¼�� */ system("cp -f ./etc/sapp.toml /tmp/sapp_change_root_dir_test/config/sapp/etc/sapp.toml"); system("cp -f ./plug/conflist.inf /tmp/sapp_change_root_dir_test/config/plug/conflist.inf"); @@ -777,7 +778,7 @@ void control_get_root_dir_run(void) call_libsapp_devel_with_args(8, sapp_change_root_dir_args); - /* ִ������ټ��һ������Ŀ¼�Ƿ���sysinfo.log, �Ƿ���־������ݷ���Ԥ�� */ + /* ִ������ټ��һ������Ŀ¼�Ƿ���sysinfo.log, �Ƿ���־������ݷ���Ԥ�� */ ASSERT_EQ(expect_file_has_some_string("/tmp/sapp_change_root_dir_test/data/sysinfo.log", "17.75K"), 0); ASSERT_EQ(expect_file_has_some_string("/tmp/sapp_change_root_dir_test/data/sysinfo.log", "16.82K"), 0); ASSERT_EQ(expect_file_has_some_string("/tmp/sapp_change_root_dir_test/data/sysinfo.log", "13674"), 0); @@ -785,13 +786,13 @@ void control_get_root_dir_run(void) /* - ����stream bridge�ӿڹ��� + ����stream bridge�ӿڹ��� */ void stream_bridge_test_run(void) { set_default_config(); - /* ������Ҫ�����������bridge����, ���������²��Ŀ¼ */ + /* ������Ҫ�����������bridge����, ���������²��Ŀ¼ */ system("mkdir -p ./plug/business/gtest_sapp_1"); system("mkdir -p ./plug/business/gtest_sapp_2"); system("cp ./plug/business/gtest_sapp/libgtest_sapp.so ./plug/business/gtest_sapp_1/"); @@ -801,7 +802,7 @@ void stream_bridge_test_run(void) update_plugin_inf_with_options("./plug/business/gtest_sapp_1", "gtest1", "tcp_bridge_customer1_init", NULL, "TCP", "tcp_bridge_customer1_entry"); update_plugin_inf_with_options("./plug/business/gtest_sapp_2", "gtest2", "tcp_bridge_customer2_init", NULL, "TCP", "tcp_bridge_customer2_entry"); - /* ���²��conflist, ��һ��ʹ��update, ����ʹ��append */ + /* ���²��conflist, ��һ��ʹ��update, ����ʹ��append */ update_conflist_inf("./plug/business/gtest_sapp/gtest_sapp.inf"); append_conflist_inf("./plug/business/gtest_sapp_1/gtest_sapp.inf"); append_conflist_inf("./plug/business/gtest_sapp_2/gtest_sapp.inf"); @@ -814,9 +815,9 @@ void stream_bridge_test_run(void) /* - ���ͨ����Ԫ���ҵ�streaminfo����, + ���ͨ����Ԫ���ҵ�streaminfo����, - ͨ����ȡһ��pcap��, ���о�ȷ�ҵ�һ����. + ͨ����ȡһ��pcap��, ���о�ȷ�ҵ�һ����. */ void find_streaminfo_v4_run(void) { @@ -829,7 +830,7 @@ void find_streaminfo_v4_run(void) set_default_config(); - update_config_file("etc/sapp.toml", "worker_threads", "4"); /* ���߳������һЩ, �����ڲ�ͬ�߳���polling���ҹ��� */ + update_config_file("etc/sapp.toml", "worker_threads", "4"); /* ���߳������һЩ, �����ڲ�ͬ�߳���polling���ҹ��� */ update_config_file("etc/sapp.toml", "syn_mandatory", "0"); update_config_file("etc/sapp.toml", "reorder_pkt_max", "100"); update_config_file("etc/sapp.toml", "timeout", "0"); @@ -856,7 +857,7 @@ void find_streaminfo_v6_run(void) set_default_config(); - update_config_file("etc/sapp.toml", "worker_threads", "6"); /* ���߳������һЩ, �����ڲ�ͬ�߳���polling���ҹ��� */ + update_config_file("etc/sapp.toml", "worker_threads", "6"); /* ���߳������һЩ, �����ڲ�ͬ�߳���polling���ҹ��� */ update_config_file("etc/sapp.toml", "syn_mandatory", "0"); update_config_file("etc/sapp.toml", "reorder_pkt_max", "100"); update_config_file("etc/sapp.toml", "timeout", "0"); @@ -873,7 +874,7 @@ void find_streaminfo_v6_run(void) /* - �ڲ���Ԫ��һ��, ����㲻һ������Ԫ���ַ��ѯ. + �ڲ���Ԫ��һ��, ����㲻һ������Ԫ���ַ��ѯ. */ void find_streaminfo_diff_tunnel_v4_run(void) { @@ -905,10 +906,10 @@ void find_streaminfo_diff_tunnel_v4_run(void) /* - ���������breakpad��forkһ���½��̣��ռ������ֳ������ϴ����������� - �˹��̻�̳�sapp����������socket�����minidump�ϴ�ʱ��Ƚϳ��� - �ᵼ��sapp������ʱ�ᷢ�ֶ˿ڻ��ڱ�minidumpռ�ã�������ʱ������ - ������������֤sapp��socket��ռ�ö˿��Ƿ��ܱ���ʱ�ر�. + ���������breakpad��forkһ���½��̣��ռ������ֳ������ϴ����������� + �˹��̻�̳�sapp����������socket�����minidump�ϴ�ʱ��Ƚϳ��� + �ᵼ��sapp������ʱ�ᷢ�ֶ˿ڻ��ڱ�minidumpռ�ã�������ʱ������ + ������������֤sapp��socket��ռ�ö˿��Ƿ��ܱ���ʱ�ر�. */ void control_fork_listen_port_run(void) { @@ -939,11 +940,11 @@ void control_fork_listen_port_run(void) call_libsapp_devel_with_args(3, sapp_timestamp_argv); - /*************** ִ�е��˴�, ��sapp�����Ѿ��˳�, fork������sapp�ӽ��̿��ܸո�����, ���һ��12345�Ƿ�ռ�� *****************/ + /*************** ִ�е��˴�, ��sapp�����Ѿ��˳�, fork������sapp�ӽ��̿��ܸո�����, ���һ��12345�Ƿ�ռ�� *****************/ sleep(1); - result_fp = popen(check_listen_cmd, "r"); /* �������˳���, fork�������ӽ��̲�Ӧ���ټ����κζ˿���!! */ + result_fp = popen(check_listen_cmd, "r"); /* �������˳���, fork�������ӽ��̲�Ӧ���ټ����κζ˿���!! */ if(NULL == result_fp){ printf("\033[1;31;40mfork_listen_port error, popen cmd %s fail\033[0m\n", check_listen_cmd); gtest_set_libsapp_devel_result(GTEST_SAPP_ERR); @@ -952,7 +953,7 @@ void control_fork_listen_port_run(void) fgets(result, sizeof(result), result_fp); - if(strlen(result) == 0){ /* netstat�������, ����ȷ�� */ + if(strlen(result) == 0){ /* netstat�������, ����ȷ�� */ printf("\033[32mfork_listen_port test success!\033[0m\n"); gtest_set_libsapp_devel_result(GTEST_SAPP_SUCC); }else{ @@ -962,7 +963,7 @@ void control_fork_listen_port_run(void) fclose(result_fp); - system("killall -9 sapp"); /* ��sapp���fork���ӽ���ɱ�� */ + system("killall -9 sapp"); /* ��sapp���fork���ӽ���ɱ�� */ } @@ -985,7 +986,7 @@ void get_linkdir_from_mac_run(void) { set_default_config(); /* - 16���� �ַ� + 16���� �ַ� 0x22 " 0x2F / */ @@ -1003,7 +1004,7 @@ void get_linkdir_from_mac_run2(void) set_default_config(); /* - 16���� �ַ� + 16���� �ַ� 0x22 " 0x2F / */ @@ -1023,7 +1024,7 @@ void get_deployment_mode_mirror(void) set_default_config(); update_plugin_inf("TCP", "get_deployment_mode_tcp_udp_entry"); - set_pcap_dumpfile("tcp/tcp_simple.pcap"); /* ����Ҹ���, ʲô����, ����Ϊ������, ����ģʽ�İ�Ҫ��һ�� */ + set_pcap_dumpfile("tcp/tcp_simple.pcap"); /* ����Ҹ���, ʲô����, ����Ϊ������, ����ģʽ�İ�Ҫ��һ�� */ ASSERT_EQ(file_md5_checksum("dumpfile", "df138740a6a22ca9c977052f21f7a470"),0); call_libsapp_devel_with_args(2, sapp_start_args); @@ -1039,7 +1040,7 @@ void get_deployment_mode_transparent(void) update_config_file_by_lastNline("etc/sapp.toml", "packet_io.internal.interface", 2, "name", "lo"); update_config_file_by_lastNline("etc/sapp.toml", "packet_io.external.interface", 1, "name", "lo"); update_config_file_by_lastNline("etc/sapp.toml", "packet_io.external.interface", 2, "name", "lo"); - set_pcap_dumpfile("tcp/tcp_isn_c2s_single.pcap"); /* ����Ҹ���, ʲô����, ����Ϊ������, ����ģʽ�İ�Ҫ��һ�� */ + set_pcap_dumpfile("tcp/tcp_isn_c2s_single.pcap"); /* ����Ҹ���, ʲô����, ����Ϊ������, ����ģʽ�İ�Ҫ��һ�� */ ASSERT_EQ(file_md5_checksum("dumpfile", "a5d0d96ee6f44f729d79aeac5cc2fee0"),0); call_libsapp_devel_with_args(1, sapp_transparent_start_args); @@ -1053,14 +1054,14 @@ void get_deployment_mode_inline(void) update_config_file_by_lastline("etc/sapp.toml", "packet_io.deployment", "mode", "inline"); update_config_file_by_lastNline("etc/sapp.toml", "packet_io.internal.interface", 1, "name", "lo"); update_config_file_by_lastNline("etc/sapp.toml", "packet_io.internal.interface", 2, "name", "lo"); - update_config_file_by_lastNline("etc/sapp.toml", "packet_io.internal.interface", 1, "type", "pcap"); /* �˴���pcapģʽ����, ����Ҫ����fake marsio */ - update_config_file_by_lastNline("etc/sapp.toml", "packet_io.internal.interface", 2, "type", "pcap"); /* �˴���pcapģʽ����, ����Ҫ����fake marsio */ + update_config_file_by_lastNline("etc/sapp.toml", "packet_io.internal.interface", 1, "type", "pcap"); /* �˴���pcapģʽ����, ����Ҫ����fake marsio */ + update_config_file_by_lastNline("etc/sapp.toml", "packet_io.internal.interface", 2, "type", "pcap"); /* �˴���pcapģʽ����, ����Ҫ����fake marsio */ update_config_file("etc/sapp.toml", "pcap_capture_direction", "\"in\""); - set_default_asymmetric_presence_layer_conf("#"); /* vxlan inlineģʽ��, asymmetric_presence_layerĬ��Ϊ�� */ + set_default_asymmetric_presence_layer_conf("#"); /* vxlan inlineģʽ��, asymmetric_presence_layerĬ��Ϊ�� */ update_config_file("etc/gdev.conf", "sendto_gdev_ip", "10.3.36.1"); update_plugin_inf("POLLING", "get_deployment_mode_tcp_udp_entry"); - set_pcap_dumpfile("for_gtest_only/inline/tcp_flow_stat.pcap"); /* ����Ҹ���, ʲô����, ����Ϊ������, ����ģʽ�İ�Ҫ��һ�� */ + set_pcap_dumpfile("for_gtest_only/inline/tcp_flow_stat.pcap"); /* ����Ҹ���, ʲô����, ����Ϊ������, ����ģʽ�İ�Ҫ��һ�� */ ASSERT_EQ(file_md5_checksum("dumpfile", "917fd6b8bc70e02812a036adf637479b"),0); call_libsapp_devel_with_args(1, sapp_inline_start_args); diff --git a/module_test/src/gtest_sapp_udp.cpp b/module_test/src/gtest_sapp_udp.cpp index 8fa7601..9fa128e 100644 --- a/module_test/src/gtest_sapp_udp.cpp +++ b/module_test/src/gtest_sapp_udp.cpp @@ -49,6 +49,7 @@ void udp_link_c2s_1pkt_run(void) update_plugin_inf("IP", "iplayer_readjust_time_entry"); append_plugin_inf("UDP", "udp_link_c2s_1pkt_entry"); append_plugin_inf("TCP", "udp_link_check_result_tcp_entry"); + append_plugin_inf("POLLING", "timer_add_1s_polling_entry"); set_pcap_dumpfile("for_gtest_only/udp/udp_C2S_1.pcap"); diff --git a/src/packet_io/packet_io_pcap.c b/src/packet_io/packet_io_pcap.c index f5a6bf5..610f59c 100644 --- a/src/packet_io/packet_io_pcap.c +++ b/src/packet_io/packet_io_pcap.c @@ -962,6 +962,11 @@ static void pcap_clear_pkt_queue_left(int thread_index) PCAP_FREE((void *)(pkt_queue_node.raw_pkt.__lib_raw_pkt_data));
}
}
+ else if (PCAP_OP_FLAG_IDLE_POLLING == pkt_queue_node.op_flag)
+ {
+ idle_polling_call(thread_index);
+ polling_stream_timeout(thread_index);
+ }
}
}
|
