diff options
author | Benny Prijono <bennylp@teluu.com> | 2012-06-05 11:49:43 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2012-06-05 11:49:43 +0000 |
commit | 610cb1615fa90db529f0f7b237782010769d03f1 (patch) | |
tree | 4ba0a809f6cfb7ba4014eb906a423797b406e285 /pjsip | |
parent | 2ffba2873e85bb5c7f9fcb025f9c28c4bb738b48 (diff) |
Re #1527: fixed bug in pjsua-lib, where registration operation may cause wrong timer entry (with _timer_id=0) to be cancelled accidentally. This could happen when turning registration ON after it was off. Thanks Itay Bianco for the report
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4155 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index 9cdbe953..d475f826 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -598,7 +598,10 @@ PJ_DEF(pj_status_t) pjsua_acc_del(pjsua_acc_id acc_id) } /* Cancel any re-registration timer */ - pjsua_cancel_timer(&acc->auto_rereg.timer); + if (acc->auto_rereg.timer.id) { + acc->auto_rereg.timer.id = PJ_FALSE; + pjsua_cancel_timer(&acc->auto_rereg.timer); + } /* Delete registration */ if (acc->regc != NULL) { @@ -2106,7 +2109,10 @@ PJ_DEF(pj_status_t) pjsua_acc_set_registration( pjsua_acc_id acc_id, PJSUA_LOCK(); /* Cancel any re-registration timer */ - pjsua_cancel_timer(&pjsua_var.acc[acc_id].auto_rereg.timer); + if (pjsua_var.acc[acc_id].auto_rereg.timer.id) { + pjsua_var.acc[acc_id].auto_rereg.timer.id = PJ_FALSE; + pjsua_cancel_timer(&pjsua_var.acc[acc_id].auto_rereg.timer); + } /* Reset pointer to registration transport */ pjsua_var.acc[acc_id].auto_rereg.reg_tp = NULL; @@ -2905,7 +2911,10 @@ static void schedule_reregistration(pjsua_acc *acc) } /* Cancel any re-registration timer */ - pjsua_cancel_timer(&acc->auto_rereg.timer); + if (acc->auto_rereg.timer.id) { + acc->auto_rereg.timer.id = PJ_FALSE; + pjsua_cancel_timer(&acc->auto_rereg.timer); + } /* Update re-registration flag */ acc->auto_rereg.active = PJ_TRUE; @@ -2932,7 +2941,9 @@ static void schedule_reregistration(pjsua_acc *acc) "Scheduling re-registration retry for acc %d in %u seconds..", acc->index, delay.sec)); - pjsua_schedule_timer(&acc->auto_rereg.timer, &delay); + acc->auto_rereg.timer.id = PJ_TRUE; + if (pjsua_schedule_timer(&acc->auto_rereg.timer, &delay) != PJ_SUCCESS) + acc->auto_rereg.timer.id = PJ_FALSE; } |