summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsip-ua
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2012-04-11 09:41:25 +0000
committerBenny Prijono <bennylp@teluu.com>2012-04-11 09:41:25 +0000
commit78ce50707aff32caa195be402721001d51dba2c0 (patch)
tree10e27f86a863393c2281ba6e1005c833405a6856 /pjsip/src/pjsip-ua
parentc4cf3952e436987946dd8d7626b9cf0c4d75656a (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/pjsip-ua')
-rw-r--r--pjsip/src/pjsip-ua/sip_reg.c15
1 files changed, 14 insertions, 1 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;