- Timestamp:
- Dec 28, 2016 3:40:07 AM (8 years ago)
- Location:
- pjproject/branches/projects/uwp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/uwp
- Property svn:mergeinfo changed
/pjproject/trunk (added) merged: 5209,5212-5234,5237-5253,5255,5257-5292,5294-5297,5299-5332,5334-5394,5396-5438,5440-5469,5471-5496,5498-5510
- Property svn:mergeinfo changed
-
pjproject/branches/projects/uwp/pjsip/src/pjsip-ua/sip_inv.c
r5109 r5513 196 196 197 197 /* 198 * Add reference to INVITE session. 199 */ 200 PJ_DEF(pj_status_t) pjsip_inv_add_ref( pjsip_inv_session *inv ) 201 { 202 PJ_ASSERT_RETURN(inv && inv->ref_cnt, PJ_EINVAL); 203 204 pj_atomic_inc(inv->ref_cnt); 205 206 return PJ_SUCCESS; 207 } 208 209 static void inv_session_destroy(pjsip_inv_session *inv) 210 { 211 if (inv->last_ack) { 212 pjsip_tx_data_dec_ref(inv->last_ack); 213 inv->last_ack = NULL; 214 } 215 if (inv->invite_req) { 216 pjsip_tx_data_dec_ref(inv->invite_req); 217 inv->invite_req = NULL; 218 } 219 if (inv->pending_bye) { 220 pjsip_tx_data_dec_ref(inv->pending_bye); 221 inv->pending_bye = NULL; 222 } 223 pjsip_100rel_end_session(inv); 224 pjsip_timer_end_session(inv); 225 pjsip_dlg_dec_session(inv->dlg, &mod_inv.mod); 226 227 /* Release the flip-flop pools */ 228 pj_pool_release(inv->pool_prov); 229 inv->pool_prov = NULL; 230 pj_pool_release(inv->pool_active); 231 inv->pool_active = NULL; 232 233 pj_atomic_destroy(inv->ref_cnt); 234 inv->ref_cnt = NULL; 235 } 236 237 /* 238 * Decrease INVITE session reference, destroy it when the reference count 239 * reaches zero. 240 */ 241 PJ_DEF(pj_status_t) pjsip_inv_dec_ref( pjsip_inv_session *inv ) 242 { 243 pj_atomic_value_t ref_cnt; 244 245 PJ_ASSERT_RETURN(inv && inv->ref_cnt, PJ_EINVAL); 246 247 ref_cnt = pj_atomic_dec_and_get(inv->ref_cnt); 248 pj_assert( ref_cnt >= 0); 249 if (ref_cnt == 0) { 250 inv_session_destroy(inv); 251 return PJ_EGONE; 252 } 253 return PJ_SUCCESS; 254 } 255 256 /* 198 257 * Set session state. 199 258 */ … … 226 285 } 227 286 228 if (pjmedia_sdp_neg_get_state(inv->neg)!=PJMEDIA_SDP_NEG_STATE_DONE && 229 (tsx_inv_data && !tsx_inv_data->sdp_done) ) 287 if ((tsx_inv_data && !tsx_inv_data->sdp_done) && 288 (!inv->neg || pjmedia_sdp_neg_get_state(inv->neg)!= 289 PJMEDIA_SDP_NEG_STATE_DONE)) 230 290 { 231 291 pjsip_tx_data *bye; … … 261 321 prev_state != PJSIP_INV_STATE_DISCONNECTED) 262 322 { 263 if (inv->last_ack) { 264 pjsip_tx_data_dec_ref(inv->last_ack); 265 inv->last_ack = NULL; 266 } 267 if (inv->invite_req) { 268 pjsip_tx_data_dec_ref(inv->invite_req); 269 inv->invite_req = NULL; 270 } 271 if (inv->pending_bye) { 272 pjsip_tx_data_dec_ref(inv->pending_bye); 273 inv->pending_bye = NULL; 274 } 275 pjsip_100rel_end_session(inv); 276 pjsip_timer_end_session(inv); 277 pjsip_dlg_dec_session(inv->dlg, &mod_inv.mod); 278 279 /* Release the flip-flop pools */ 280 pj_pool_release(inv->pool_prov); 281 inv->pool_prov = NULL; 282 pj_pool_release(inv->pool_active); 283 inv->pool_active = NULL; 323 pjsip_inv_dec_ref(inv); 284 324 } 285 325 } … … 838 878 pj_assert(inv != NULL); 839 879 880 status = pj_atomic_create(dlg->pool, 0, &inv->ref_cnt); 881 if (status != PJ_SUCCESS) { 882 pjsip_dlg_dec_lock(dlg); 883 return status; 884 } 885 840 886 inv->pool = dlg->pool; 841 887 inv->role = PJSIP_ROLE_UAC; … … 881 927 882 928 /* Done */ 929 pjsip_inv_add_ref(inv); 883 930 *p_inv = inv; 884 931 … … 1471 1518 pj_assert(inv != NULL); 1472 1519 1520 status = pj_atomic_create(dlg->pool, 0, &inv->ref_cnt); 1521 if (status != PJ_SUCCESS) { 1522 pjsip_dlg_dec_lock(dlg); 1523 return status; 1524 } 1525 1473 1526 inv->pool = dlg->pool; 1474 1527 inv->role = PJSIP_ROLE_UAS; … … 1540 1593 1541 1594 /* Done */ 1595 pjsip_inv_add_ref(inv); 1542 1596 pjsip_dlg_dec_lock(dlg); 1543 1597 *p_inv = inv;
Note: See TracChangeset
for help on using the changeset viewer.