adjust timers and document a test that tends to fail sometimes.

This commit is contained in:
Simon Morlat 2016-12-13 22:25:52 +01:00
parent 3cfab1c16d
commit 2ad32695a5
2 changed files with 13 additions and 7 deletions

View file

@ -140,7 +140,7 @@ static void subscriber_no_longer_reachable(void){
lcs = bctbx_list_append(lcs, marie->lc);
lcs = bctbx_list_append(lcs, pauline1->lc);
lp_config_set_int(marie->lc->config, "sip", "subscribe_expires", 60);
lp_config_set_int(marie->lc->config, "sip", "subscribe_expires", 80);
linphone_core_set_user_agent(marie->lc, "full-presence-support", NULL);
linphone_core_set_user_agent(pauline1->lc, "full-presence-support", NULL);
@ -152,7 +152,7 @@ static void subscriber_no_longer_reachable(void){
linphone_core_add_friend(marie->lc, lf);
linphone_friend_unref(lf);
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceBasicStatusOpen,1, 2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceBasicStatusOpen,1, 5000));
/*make sure marie subscribe is not reset by accident because of code below located in linphone_core_iterate
@ -173,16 +173,22 @@ static void subscriber_no_longer_reachable(void){
//sal_set_send_error(marie->lc->sal,0);
/*because of notify timeout detected by server, so subscription is reset*/
/*
* Because of notify timeout detected by server, subscription is reset.
* The server then sends a NOTIFY with subscription-state terminated, which translated in Offline status to be notified.
*/
previous_number_of_LinphonePresenceActivityOffline = marie->stat.number_of_LinphonePresenceBasicStatusClosed;
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceActivityOffline,previous_number_of_LinphonePresenceActivityOffline+1, 4000));
// now subscription is supposed to be dead because notify was not answered in time.
/*
* The client handles this subscription terminated event.
* It will not resubmit a new SUBSCRIBE until expiration of the current one.
*/
presence =linphone_presence_model_new_with_activity(LinphonePresenceActivityOnline,NULL);
linphone_core_set_presence_model(pauline1->lc,presence);
/*because subscription not is automatically restarted*/
BC_ASSERT_FALSE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceActivityOnline,previous_number_of_LinphonePresenceActivityOnline+1, 4000));
/*because subscription is not restarted, the online status shall not be notified again.*/
BC_ASSERT_FALSE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceActivityOnline,previous_number_of_LinphonePresenceActivityOnline+1, 8000));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline1);

View file

@ -438,7 +438,7 @@ void linphone_core_manager_stop(LinphoneCoreManager *mgr){
}
}
linphone_core_destroy(mgr->lc);
if (chatdb) {
if (chatdb && ortp_file_exist(chatdb)==0) {
if (unlink(chatdb) != 0){
ms_error("Could not delete %s: %s", chatdb, strerror(errno));
}