From 6e48a186a1d35be3701c4caa5295925b24e0cb57 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Tue, 6 Aug 2013 06:52:43 +0000 Subject: Re #1669: fixed bug introduced by r4523 which caused pjsua_acc_modify() to always reregister regardless of whether there is change or not git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4579 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsua-lib/pjsua_acc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'pjsip') diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index 52c5685d..fd102ee8 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -1048,6 +1048,7 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, /* Credential info */ { unsigned i; + pj_bool_t cred_changed = PJ_FALSE; /* Selective update credential info. */ for (i = 0; i < cfg->cred_count; ++i) { @@ -1071,6 +1072,8 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, /* Not found, insert this */ if (j == acc->cfg.cred_count) { + cred_changed = PJ_TRUE; + /* If account credential is full, discard the last one. */ if (acc->cfg.cred_count == PJ_ARRAY_SIZE(acc->cfg.cred_info)) { pj_array_erase(acc->cfg.cred_info, sizeof(pjsip_cred_info), @@ -1097,8 +1100,10 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, acc->cred[acc->cred_cnt++] = pjsua_var.ua_cfg.cred_info[i]; } - update_reg = PJ_TRUE; - unreg_first = PJ_TRUE; + if (cred_changed) { + update_reg = PJ_TRUE; + unreg_first = PJ_TRUE; + } } /* Authentication preference */ -- cgit v1.2.3