From cfeca1b1f47b6baade7f873c3054ee1b6dcf6ee8 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 2 Jul 2015 15:52:43 +0200 Subject: [PATCH] flexisip_tester.c: remove some linphone core and improve ddos test --- tester/flexisip/flexisip.conf | 2 +- tester/flexisip_tester.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tester/flexisip/flexisip.conf b/tester/flexisip/flexisip.conf index 96e70b90a..7fe250368 100644 --- a/tester/flexisip/flexisip.conf +++ b/tester/flexisip/flexisip.conf @@ -613,5 +613,5 @@ packet-rate-limit=5 # So if the unban command is queued at 13:11:56 and scheduled and # the ban time is 1 minute, it will be executed at 13:12:00) # Default value: 2 -ban-time=2 +ban-time=1 diff --git a/tester/flexisip_tester.c b/tester/flexisip_tester.c index 850b64ef2..1cfc4dbff 100644 --- a/tester/flexisip_tester.c +++ b/tester/flexisip_tester.c @@ -119,6 +119,7 @@ static void message_forking_with_unreachable_recipients(void) { linphone_core_manager_destroy(marie); linphone_core_manager_destroy(marie2); + linphone_core_manager_destroy(marie3); linphone_core_manager_destroy(pauline); ms_free(to); ms_list_free(lcs); @@ -169,6 +170,7 @@ static void message_forking_with_all_recipients_unreachable(void) { linphone_core_manager_destroy(marie); linphone_core_manager_destroy(marie2); + linphone_core_manager_destroy(marie3); linphone_core_manager_destroy(pauline); ms_free(to); ms_list_free(lcs); @@ -800,7 +802,7 @@ static void file_transfer_message_rcs_to_external_body_client(void) { } } -static void send_file_transfer_message_using_external_body_url(LinphoneCoreManager *marie, LinphoneCoreManager *pauline) { +void send_file_transfer_message_using_external_body_url(LinphoneCoreManager *marie, LinphoneCoreManager *pauline) { char *to; LinphoneChatMessageCbs *cbs; LinphoneChatRoom *chat_room; @@ -877,6 +879,7 @@ static void dos_module_trigger(void) { char *to; LinphoneChatRoom *chat_room; int i = 0; + const char* passmsg = "This one should pass through"; int number_of_messge_to_send = 100; LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); @@ -896,15 +899,18 @@ static void dos_module_trigger(void) { } while (i < number_of_messge_to_send); // At this point we should be banned for a minute - ms_usleep(90000000); // Wait 90 seconds to ensure we are not banned anymore + ms_usleep(65000000); // Wait several seconds to ensure we are not banned anymore BC_ASSERT_LOWER(marie->stat.number_of_LinphoneMessageReceived, number_of_messge_to_send, int, "%d"); reset_counters(&marie->stat); reset_counters(&pauline->stat); - linphone_chat_room_send_message(chat_room, "This one should pass through"); + linphone_chat_room_send_message(chat_room, passmsg); BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived, 1)); - + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceived, 1, int, "%d"); + if (marie->stat.last_received_chat_message) { + BC_ASSERT_NSTRING_EQUAL(linphone_chat_message_get_text(marie->stat.last_received_chat_message), passmsg, strlen(passmsg)); + } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); ms_free(to);