don't send register when nothing has changed.

This commit is contained in:
Simon Morlat 2016-10-08 09:13:57 +02:00
parent f1ae36112b
commit 0be87c5c24
3 changed files with 13 additions and 9 deletions

View file

@ -65,6 +65,10 @@ LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_is_server_confi
LinphoneProxyConfigAddressComparisonResult result_identity;
LinphoneProxyConfigAddressComparisonResult result;
ms_message("linphone_proxy_config_is_server_config_changed: %s->%s %s->%s",
cfg->saved_identity ? linphone_address_as_string(cfg->saved_identity) : "", linphone_address_as_string(cfg->identity_address),
cfg->saved_proxy ? linphone_address_as_string(cfg->saved_proxy) : "", linphone_address_as_string(current_proxy));
result = linphone_proxy_config_address_equal(cfg->saved_identity,cfg->identity_address);
if (result == LinphoneProxyConfigAddressDifferent) goto end;
result_identity = result;
@ -79,6 +83,7 @@ LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_is_server_confi
end:
if (current_proxy) linphone_address_destroy(current_proxy);
ms_message("linphone_proxy_config_is_server_config_changed : %i", result);
return result;
}
@ -762,7 +767,7 @@ int linphone_proxy_config_done(LinphoneProxyConfig *cfg)
if (!linphone_proxy_config_check(cfg->lc,cfg))
return -1;
/*check if server address as changed*/
/*check if server address has changed*/
res = linphone_proxy_config_is_server_config_changed(cfg);
if (res != LinphoneProxyConfigAddressEqual) {
/* server config has changed, need to unregister from previous first*/
@ -778,22 +783,21 @@ int linphone_proxy_config_done(LinphoneProxyConfig *cfg)
if (res == LinphoneProxyConfigAddressDifferent) {
_linphone_proxy_config_unpublish(cfg);
}
}
cfg->commit = TRUE;
}
if (linphone_proxy_config_compute_publish_params_hash(cfg)) {
ms_message("Publish params have changed on proxy config [%p]",cfg);
if (cfg->long_term_event) {
if (!cfg->publish) {
/*publish is terminated*/
linphone_event_terminate(cfg->long_term_event);
} else {
if (cfg->publish) {
const char * sip_etag = linphone_event_get_custom_header(cfg->long_term_event, "SIP-ETag");
if (sip_etag) {
if (cfg->sip_etag) ms_free(cfg->sip_etag);
cfg->sip_etag = ms_strdup(sip_etag);
}
}
/*publish is terminated*/
linphone_event_terminate(cfg->long_term_event);
linphone_event_unref(cfg->long_term_event);
cfg->long_term_event = NULL;
}
@ -801,7 +805,7 @@ int linphone_proxy_config_done(LinphoneProxyConfig *cfg)
} else {
ms_message("Publish params have not changed on proxy config [%p]",cfg);
}
cfg->commit=TRUE;
linphone_proxy_config_write_all_to_config_file(cfg->lc);
return 0;
}

View file

@ -447,7 +447,7 @@ static void test_presence_list_base(bool_t enable_compression) {
reset_counters(&laure->stat);
reset_counters(&marie->stat);
/*keep in ming long terme presence*/
/*keep in mind long terme presence*/
if (!BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphonePresenceActivityOnline, 1, 4000)))
goto end;

View file

@ -424,7 +424,7 @@ void linphone_core_manager_stop(LinphoneCoreManager *mgr){
if (mgr->lc) {
const char *record_file = linphone_core_get_record_file(mgr->lc);
char *chatdb = ms_strdup(linphone_core_get_chat_database_path(mgr->lc));
if (!liblinphone_tester_keep_record_files && record_file) {
if (!liblinphone_tester_keep_record_files && record_file && ortp_file_exist(record_file)) {
if ((bc_get_number_of_failures() - mgr->number_of_bcunit_error_at_creation)>0) {
ms_error("Test has failed, keeping recorded file [%s]", record_file);
}