forked from mirrors/linphone-iphone
better mgt of refresher in case of registration error
This commit is contained in:
parent
7427b28169
commit
162f121348
2 changed files with 30 additions and 4 deletions
|
|
@ -270,6 +270,9 @@ void linphone_proxy_config_edit(LinphoneProxyConfig *obj){
|
|||
if (obj->state == LinphoneRegistrationOk
|
||||
|| obj->state == LinphoneRegistrationProgress) {
|
||||
sal_unregister(obj->op);
|
||||
} else {
|
||||
/*stop refresher*/
|
||||
if (obj->op) sal_op_stop_refreshing(obj->op);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -351,6 +354,9 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
|
|||
linphone_proxy_config_set_state(obj,LinphoneRegistrationFailed,"Registration failed");
|
||||
}
|
||||
ms_free(proxy_string);
|
||||
} else {
|
||||
/*stop refresher, just in case*/
|
||||
if (obj->op) sal_op_stop_refreshing(obj->op);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -332,8 +332,7 @@ static void authenticated_register_with_wrong_late_credentials(){
|
|||
linphone_core_manager_destroy(mgr);
|
||||
}
|
||||
|
||||
static void authenticated_register_with_wrong_credentials_with_params(const char* user_agent) {
|
||||
LinphoneCoreManager *mgr;
|
||||
static void authenticated_register_with_wrong_credentials_with_params_base(const char* user_agent,LinphoneCoreManager *mgr) {
|
||||
stats* counters;
|
||||
LCSipTransports transport = {5070,5070,0,5071};
|
||||
LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,"wrong passwd",NULL,auth_domain,NULL); /*create authentication structure from identity*/
|
||||
|
|
@ -341,8 +340,6 @@ static void authenticated_register_with_wrong_credentials_with_params(const char
|
|||
|
||||
sprintf(route,"sip:%s",test_route);
|
||||
|
||||
mgr=linphone_core_manager_new(NULL);
|
||||
|
||||
mgr->lc->vtable.auth_info_requested=auth_info_requested2;
|
||||
|
||||
sal_set_refresher_retry_after(mgr->lc->sal,500);
|
||||
|
|
@ -372,11 +369,33 @@ static void authenticated_register_with_wrong_credentials_with_params(const char
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
static void authenticated_register_with_wrong_credentials_with_params(const char* user_agent) {
|
||||
LinphoneCoreManager *mgr = linphone_core_manager_new(NULL);
|
||||
authenticated_register_with_wrong_credentials_with_params_base(user_agent,mgr);
|
||||
linphone_core_manager_destroy(mgr);
|
||||
}
|
||||
static void authenticated_register_with_wrong_credentials() {
|
||||
authenticated_register_with_wrong_credentials_with_params(NULL);
|
||||
}
|
||||
static void authenticated_register_with_wrong_credentials_2() {
|
||||
LinphoneCoreManager *mgr = linphone_core_manager_new(NULL);
|
||||
stats* counters = get_stats(mgr->lc);
|
||||
int current_in_progress;
|
||||
LinphoneProxyConfig* proxy;
|
||||
|
||||
authenticated_register_with_wrong_credentials_with_params_base(NULL,mgr);
|
||||
|
||||
linphone_core_get_default_proxy(mgr->lc,&proxy);
|
||||
/*Make sure registration attempts are stopped*/
|
||||
linphone_proxy_config_edit(proxy);
|
||||
linphone_proxy_config_enable_register(proxy,FALSE);
|
||||
linphone_proxy_config_done(proxy);
|
||||
current_in_progress=counters->number_of_LinphoneRegistrationProgress;
|
||||
CU_ASSERT_FALSE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationProgress,current_in_progress+1));
|
||||
|
||||
linphone_core_manager_destroy(mgr);
|
||||
}
|
||||
static void authenticated_register_with_wrong_credentials_without_403() {
|
||||
authenticated_register_with_wrong_credentials_with_params("tester-no-403");
|
||||
}
|
||||
|
|
@ -655,6 +674,7 @@ test_t register_tests[] = {
|
|||
{ "Ha1 authenticated register", ha1_authenticated_register },
|
||||
{ "Digest auth without initial credentials", authenticated_register_with_no_initial_credentials },
|
||||
{ "Digest auth with wrong credentials", authenticated_register_with_wrong_credentials },
|
||||
{ "Digest auth with wrong credentials, check if registration attempts are stopped", authenticated_register_with_wrong_credentials_2 },
|
||||
{ "Digest auth with wrong credentials without 403", authenticated_register_with_wrong_credentials_without_403},
|
||||
{ "Authenticated register with wrong late credentials", authenticated_register_with_wrong_late_credentials},
|
||||
{ "Authenticated register with late credentials", authenticated_register_with_late_credentials },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue