diff options
author | Benny Prijono <bennylp@teluu.com> | 2012-04-11 09:41:25 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2012-04-11 09:41:25 +0000 |
commit | 78ce50707aff32caa195be402721001d51dba2c0 (patch) | |
tree | 10e27f86a863393c2281ba6e1005c833405a6856 /pjsip/src | |
parent | c4cf3952e436987946dd8d7626b9cf0c4d75656a (diff) |
More re #1481: Destroying the regc may lead to dangling binding in the register, so instead of destroying the regc, instruct it to release the transport instead
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@4037 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src')
-rw-r--r-- | pjsip/src/pjsip-ua/sip_reg.c | 15 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 7 |
2 files changed, 18 insertions, 4 deletions
diff --git a/pjsip/src/pjsip-ua/sip_reg.c b/pjsip/src/pjsip-ua/sip_reg.c index 750e22f7..c02c17bb 100644 --- a/pjsip/src/pjsip-ua/sip_reg.c +++ b/pjsip/src/pjsip-ua/sip_reg.c @@ -440,6 +440,17 @@ PJ_DEF(pj_status_t) pjsip_regc_set_transport( pjsip_regc *regc, return PJ_SUCCESS; } +/* Release transport */ +PJ_DEF(pj_status_t) pjsip_regc_release_transport(pjsip_regc *regc) +{ + PJ_ASSERT_RETURN(regc, PJ_EINVAL); + if (regc->last_transport) { + pjsip_transport_dec_ref(regc->last_transport); + regc->last_transport = NULL; + } + return PJ_SUCCESS; +} + PJ_DEF(pj_status_t) pjsip_regc_add_headers( pjsip_regc *regc, const pjsip_hdr *hdr_list) @@ -1269,7 +1280,9 @@ PJ_DEF(pj_status_t) pjsip_regc_send(pjsip_regc *regc, pjsip_tx_data *tdata) pj_lock_acquire(regc->lock); /* Get last transport used and add reference to it */ - if (tdata->tp_info.transport != regc->last_transport) { + if (tdata->tp_info.transport != regc->last_transport && + status==PJ_SUCCESS) + { if (regc->last_transport) { pjsip_transport_dec_ref(regc->last_transport); regc->last_transport = NULL; diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index a0a5d81d..4758f391 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -2821,11 +2821,12 @@ void pjsua_acc_on_tp_state_changed(pjsip_transport *tp, continue; } - /* Destroy regc to release transport immediately */ + /* Release regc transport immediately + * See https://trac.pjsip.org/repos/ticket/1481 + */ if (pjsua_var.acc[i].regc) { - pjsip_regc_destroy(pjsua_var.acc[i].regc); + pjsip_regc_release_transport(pjsua_var.acc[i].regc); } - pjsua_var.acc[i].regc = NULL; /* Schedule reregistration for this account */ schedule_reregistration(acc); |