summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiza Sulistyo <riza@teluu.com>2013-03-01 03:04:16 +0000
committerRiza Sulistyo <riza@teluu.com>2013-03-01 03:04:16 +0000
commit4a841f08f9eda7a9649e15f8ce2afd2d5ff9b9b4 (patch)
tree29682ed1c4fb6194bdee8467136c9e30b73cdbd5
parent26bdd9238b26027a55067fb961272d4af038baca (diff)
Re #1604: backported to 1.x
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@4409 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjnath/src/pjnath/ice_strans.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c
index 618c87ae..650b5f03 100644
--- a/pjnath/src/pjnath/ice_strans.c
+++ b/pjnath/src/pjnath/ice_strans.c
@@ -709,21 +709,14 @@ static void sess_init_update(pj_ice_strans *ice_st)
*/
PJ_DEF(pj_status_t) pj_ice_strans_destroy(pj_ice_strans *ice_st)
{
- char obj_name[PJ_MAX_OBJ_NAME];
-
PJ_ASSERT_RETURN(ice_st, PJ_EINVAL);
-
+ sess_add_ref(ice_st);
ice_st->destroy_req = PJ_TRUE;
- if (pj_atomic_get(ice_st->busy_cnt) > 0) {
+ if (sess_dec_ref(ice_st)) {
PJ_LOG(5,(ice_st->obj_name,
"ICE strans object is busy, will destroy later"));
return PJ_EPENDING;
}
-
- pj_memcpy(obj_name, ice_st->obj_name, PJ_MAX_OBJ_NAME);
- destroy_ice_st(ice_st);
-
- PJ_LOG(4,(obj_name, "ICE stream transport destroyed"));
return PJ_SUCCESS;
}
@@ -745,7 +738,7 @@ static pj_bool_t sess_dec_ref(pj_ice_strans *ice_st)
int count = pj_atomic_dec_and_get(ice_st->busy_cnt);
pj_assert(count >= 0);
if (count==0 && ice_st->destroy_req) {
- pj_ice_strans_destroy(ice_st);
+ destroy_ice_st(ice_st);
return PJ_FALSE;
} else {
return PJ_TRUE;