Changeset 5241
- Timestamp:
- Feb 5, 2016 4:29:17 AM (9 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/footprint.c
r3553 r5241 342 342 pjsip_ua_destroy(); 343 343 pjsip_dlg_create_uac(NULL, NULL, NULL, NULL, NULL, NULL); 344 pjsip_dlg_create_uas (NULL, NULL, NULL, NULL);344 pjsip_dlg_create_uas_and_inc_lock(NULL, NULL, NULL, NULL); 345 345 pjsip_dlg_terminate(NULL); 346 346 pjsip_dlg_set_route_set(NULL, NULL); -
pjproject/trunk/pjsip-apps/src/samples/pjsip-perf.c
r5170 r5241 476 476 477 477 /* Create UAS dialog */ 478 status = pjsip_dlg_create_uas ( pjsip_ua_instance(), rdata,479 478 status = pjsip_dlg_create_uas_and_inc_lock( pjsip_ua_instance(), rdata, 479 &app.local_contact, &dlg); 480 480 if (status != PJ_SUCCESS) { 481 481 const pj_str_t reason = pj_str("Unable to create dialog"); … … 503 503 pjsip_dlg_create_response(dlg, rdata, 500, NULL, &tdata); 504 504 pjsip_dlg_send_response(dlg, pjsip_rdata_get_tsx(rdata), tdata); 505 pjsip_dlg_dec_lock(dlg); 505 506 return PJ_TRUE; 506 507 } 507 508 509 /* Invite session has been created, decrement & release dialog lock. */ 510 pjsip_dlg_dec_lock(dlg); 511 508 512 /* Send 100/Trying if needed */ 509 513 if (app.server.send_trying) { -
pjproject/trunk/pjsip-apps/src/samples/simpleua.c
r4815 r5241 726 726 * Create UAS dialog. 727 727 */ 728 status = pjsip_dlg_create_uas ( pjsip_ua_instance(),729 730 731 728 status = pjsip_dlg_create_uas_and_inc_lock( pjsip_ua_instance(), 729 rdata, 730 &local_uri, /* contact */ 731 &dlg); 732 732 if (status != PJ_SUCCESS) { 733 733 pjsip_endpt_respond_stateless(g_endpt, rdata, 500, NULL, … … 742 742 status = pjmedia_endpt_create_sdp( g_med_endpt, rdata->tp_info.pool, 743 743 MAX_MEDIA_CNT, g_sock_info, &local_sdp); 744 PJ_ASSERT_RETURN(status == PJ_SUCCESS, PJ_TRUE); 744 pj_assert(status == PJ_SUCCESS); 745 if (status != PJ_SUCCESS) { 746 pjsip_dlg_dec_lock(dlg); 747 return PJ_TRUE; 748 } 745 749 746 750 … … 750 754 */ 751 755 status = pjsip_inv_create_uas( dlg, rdata, local_sdp, 0, &g_inv); 752 PJ_ASSERT_RETURN(status == PJ_SUCCESS, PJ_TRUE); 756 pj_assert(status == PJ_SUCCESS); 757 if (status != PJ_SUCCESS) { 758 pjsip_dlg_dec_lock(dlg); 759 return PJ_TRUE; 760 } 761 762 /* 763 * Invite session has been created, decrement & release dialog lock. 764 */ 765 pjsip_dlg_dec_lock(dlg); 753 766 754 767 -
pjproject/trunk/pjsip-apps/src/samples/sipecho.c
r4537 r5241 418 418 char temp[80], hostip[PJ_INET6_ADDRSTRLEN]; 419 419 pj_str_t local_uri; 420 pjsip_dialog *dlg ;420 pjsip_dialog *dlg = NULL; 421 421 pjsip_rdata_sdp_info *sdp_info; 422 422 pjmedia_sdp_session *answer = NULL; … … 499 499 local_uri = pj_str(temp); 500 500 501 status = pjsip_dlg_create_uas ( pjsip_ua_instance(), rdata,502 501 status = pjsip_dlg_create_uas_and_inc_lock( pjsip_ua_instance(), rdata, 502 &local_uri, &dlg); 503 503 504 504 if (status == PJ_SUCCESS) 505 505 answer = create_answer((int)(call-app.call), dlg->pool, sdp_info->sdp); 506 506 507 if (status == PJ_SUCCESS) 507 508 status = pjsip_inv_create_uas( dlg, rdata, answer, 0, &call->inv); 509 510 if (dlg) 511 pjsip_dlg_dec_lock(dlg); 512 508 513 if (status == PJ_SUCCESS) 509 514 status = pjsip_inv_initial_answer(call->inv, rdata, 100, -
pjproject/trunk/pjsip-apps/src/samples/siprtp.c
r5170 r5241 638 638 639 639 /* Create UAS dialog */ 640 status = pjsip_dlg_create_uas ( pjsip_ua_instance(), rdata,641 640 status = pjsip_dlg_create_uas_and_inc_lock( pjsip_ua_instance(), rdata, 641 &app.local_contact, &dlg); 642 642 if (status != PJ_SUCCESS) { 643 643 const pj_str_t reason = pj_str("Unable to create dialog"); … … 656 656 pjsip_dlg_create_response(dlg, rdata, 500, NULL, &tdata); 657 657 pjsip_dlg_send_response(dlg, pjsip_rdata_get_tsx(rdata), tdata); 658 pjsip_dlg_dec_lock(dlg); 658 659 return; 659 660 } 660 661 662 /* Invite session has been created, decrement & release dialog lock */ 663 pjsip_dlg_dec_lock(dlg); 661 664 662 665 /* Attach call data to invite session */ -
pjproject/trunk/pjsip/include/pjsip-ua/sip_replaces.h
r3553 r5241 139 139 // Create UAS Invite session as usual. 140 140 // 141 status = pjsip_dlg_create_uas (.., rdata, .., &dlg);141 status = pjsip_dlg_create_uas_and_inc_lock(.., rdata, .., &dlg); 142 142 .. 143 143 status = pjsip_inv_create_uas(dlg, .., &inv); -
pjproject/trunk/pjsip/include/pjsip/sip_dialog.h
r4173 r5241 61 61 PJ_BEGIN_DECL 62 62 63 64 /* Deprecated API pjsip_dlg_create_uas() due to a fatal bug of possible 65 * premature dialog destroy. Application should not change this setting, 66 * unless it uses single worker thread. 67 * See also https://trac.pjsip.org/repos/ticket/1902. 68 */ 69 #ifndef DEPRECATED_FOR_TICKET_1902 70 # define DEPRECATED_FOR_TICKET_1902 1 71 #endif 63 72 64 73 /** … … 241 250 242 251 252 #if !DEPRECATED_FOR_TICKET_1902 243 253 /** 244 254 * Initialize UAS dialog from the information found in the incoming request … … 280 290 const pj_str_t *contact, 281 291 pjsip_dialog **p_dlg); 292 #endif 293 294 295 /** 296 * Initialize UAS dialog from the information found in the incoming request 297 * that creates a dialog (such as INVITE, REFER, or SUBSCRIBE), and set the 298 * local Contact to contact. If contact is not specified, the local contact 299 * is initialized from the URI in the To header in the request. 300 * 301 * This function will also create UAS transaction for the incoming request, 302 * and associate the transaction to the rdata. Application can query the 303 * transaction used to handle this request by calling #pjsip_rdata_get_tsx() 304 * after this function returns. 305 * 306 * Note that initially, the session count in the dialog will be initialized 307 * to 1 (one), and the dialog is locked. Application needs to explicitly call 308 * #pjsip_dlg_dec_lock() to release the lock and decrease the session count. 309 * 310 * 311 * @param ua The user agent module instance. 312 * @param rdata The incoming request that creates the dialog, 313 * such as INVITE, SUBSCRIBE, or REFER. 314 * @param contact Optional dialog local Contact to be put as Contact 315 * header value, hence the format must follow 316 * RFC 3261 Section 20.10: 317 * When the header field value contains a display 318 * name, the URI including all URI parameters is 319 * enclosed in "<" and ">". If no "<" and ">" are 320 * present, all parameters after the URI are header 321 * parameters, not URI parameters. The display name 322 * can be tokens, or a quoted string, if a larger 323 * character set is desired. 324 * If this argument is NULL, the local contact will be 325 * initialized from the value of To header in the 326 * request. 327 * @param p_dlg Pointer to receive the dialog. 328 * 329 * @return PJ_SUCCESS on success. 330 */ 331 PJ_DECL(pj_status_t) 332 pjsip_dlg_create_uas_and_inc_lock( pjsip_user_agent *ua, 333 pjsip_rx_data *rdata, 334 const pj_str_t *contact, 335 pjsip_dialog **p_dlg); 282 336 283 337 … … 362 416 * established, the route set can not be changed. 363 417 * 364 * For UAS dialog,the route set will be initialized in pjsip_dlg_create_uas() 365 * from the Record-Route headers in the incoming request. 418 * For UAS dialog, the route set will be initialized in 419 * pjsip_dlg_create_uas_and_inc_lock() from the Record-Route headers in 420 * the incoming request. 366 421 * 367 422 * The route_set argument is standard list of Route headers (i.e. with -
pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
r5180 r5241 312 312 * Create UAS dialog. 313 313 */ 314 PJ_DEF(pj_status_t) pjsip_dlg_create_uas( pjsip_user_agent *ua, 315 pjsip_rx_data *rdata, 316 const pj_str_t *contact, 317 pjsip_dialog **p_dlg) 314 pj_status_t create_uas_dialog( pjsip_user_agent *ua, 315 pjsip_rx_data *rdata, 316 const pj_str_t *contact, 317 pj_bool_t inc_lock, 318 pjsip_dialog **p_dlg) 318 319 { 319 320 pj_status_t status; … … 511 512 goto on_error; 512 513 514 /* Increment the dialog's lock since tsx may cause the dialog to be 515 * destroyed prematurely (such as in case of transport error). 516 */ 517 if (inc_lock) 518 pjsip_dlg_inc_lock(dlg); 519 513 520 /* Create UAS transaction for this request. */ 514 521 status = pjsip_tsx_create_uas(dlg->ua, rdata, &tsx); … … 553 560 } 554 561 555 destroy_dialog(dlg, PJ_FALSE); 562 if (inc_lock) { 563 pjsip_dlg_dec_lock(dlg); 564 } else { 565 destroy_dialog(dlg, PJ_FALSE); 566 } 567 556 568 return status; 569 } 570 571 572 #if !DEPRECATED_FOR_TICKET_1902 573 /* 574 * Create UAS dialog. 575 */ 576 PJ_DEF(pj_status_t) pjsip_dlg_create_uas( pjsip_user_agent *ua, 577 pjsip_rx_data *rdata, 578 const pj_str_t *contact, 579 pjsip_dialog **p_dlg) 580 { 581 return create_uas_dialog(ua, rdata, contact, PJ_FALSE, p_dlg); 582 } 583 #endif 584 585 586 /* 587 * Create UAS dialog and increase its session count. 588 */ 589 PJ_DEF(pj_status_t) 590 pjsip_dlg_create_uas_and_inc_lock( pjsip_user_agent *ua, 591 pjsip_rx_data *rdata, 592 const pj_str_t *contact, 593 pjsip_dialog **p_dlg) 594 { 595 return create_uas_dialog(ua, rdata, contact, PJ_TRUE, p_dlg); 557 596 } 558 597 -
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r5147 r5241 139 139 #define TRANSPORT_ERR_TIMER 3 140 140 141 /* Flags for tsx_set_state() */ 142 enum 143 { 144 NO_NOTIFY = 1, 145 NO_SCHEDULE_HANDLER = 2, 146 }; 141 147 142 148 /* Prototypes. */ … … 170 176 pjsip_tsx_state_e state, 171 177 pjsip_event_id_e event_src_type, 172 void *event_src ); 173 static void tsx_set_state_no_notify( pjsip_transaction *tsx, 174 pjsip_tsx_state_e state, 175 pjsip_event_id_e event_src_type, 176 void *event_src ); 178 void *event_src, 179 int flag); 177 180 static void tsx_set_status_code(pjsip_transaction *tsx, 178 181 int code, const pj_str_t *reason); … … 1104 1107 if (tsx->state < PJSIP_TSX_STATE_TERMINATED) { 1105 1108 pjsip_tsx_state_e prev_state; 1109 pj_time_val timeout = { 0, 0 }; 1106 1110 1107 1111 pj_grp_lock_acquire(tsx->grp_lock); … … 1123 1127 * https://trac.pjsip.org/repos/ticket/1646 1124 1128 */ 1125 tsx_set_state_no_notify( tsx, PJSIP_TSX_STATE_TERMINATED, 1126 PJSIP_EVENT_TRANSPORT_ERROR, NULL); 1129 /* Also don't schedule tsx handler, otherwise we'll get race 1130 * condition of TU notifications due to delayed TERMINATED 1131 * state TU notification. It happened in multiple worker threads 1132 * environment between TERMINATED & DESTROYED! See: 1133 * https://trac.pjsip.org/repos/ticket/1902 1134 */ 1135 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 1136 PJSIP_EVENT_TRANSPORT_ERROR, NULL, 1137 NO_NOTIFY | NO_SCHEDULE_HANDLER); 1127 1138 pj_grp_lock_release(tsx->grp_lock); 1128 1139 … … 1139 1150 (*tsx->tsx_user->on_tsx_state)(tsx, &e); 1140 1151 } 1152 1153 /* Now let's schedule the tsx handler */ 1154 tsx_schedule_timer(tsx, &tsx->timeout_timer, &timeout, 1155 TIMEOUT_TIMER); 1141 1156 } 1142 1157 } else { … … 1168 1183 pjsip_tsx_state_e state, 1169 1184 pjsip_event_id_e event_src_type, 1170 void *event_src ) 1185 void *event_src, 1186 int flag) 1171 1187 { 1172 1188 pjsip_tsx_state_e prev_state = tsx->state; … … 1193 1209 * rx event. 1194 1210 */ 1195 if (event_src_type==PJSIP_EVENT_RX_MSG && tsx->tsx_user) { 1211 if (event_src_type==PJSIP_EVENT_RX_MSG && tsx->tsx_user && 1212 (flag & NO_NOTIFY)==0) 1213 { 1196 1214 pjsip_rx_data *rdata = (pjsip_rx_data*) event_src; 1197 1215 … … 1207 1225 1208 1226 /* Inform TU about state changed. */ 1209 if (tsx->tsx_user && tsx->tsx_user->on_tsx_state) { 1227 if (tsx->tsx_user && tsx->tsx_user->on_tsx_state && 1228 (flag & NO_NOTIFY) == 0) 1229 { 1210 1230 pjsip_event e; 1211 1231 PJSIP_EVENT_INIT_TSX_STATE(e, tsx, event_src_type, event_src, … … 1219 1239 */ 1220 1240 if (state == PJSIP_TSX_STATE_TERMINATED) { 1221 pj_time_val timeout = { 0, 0};1241 pj_time_val timeout = { 0, 0 }; 1222 1242 1223 1243 /* If we're still waiting for a message to be sent.. */ … … 1237 1257 lock_timer(tsx); 1238 1258 tsx_cancel_timer(tsx, &tsx->timeout_timer); 1239 tsx_schedule_timer( tsx, &tsx->timeout_timer, &timeout, TIMEOUT_TIMER); 1259 if ((flag & NO_SCHEDULE_HANDLER) == 0) { 1260 tsx_schedule_timer(tsx, &tsx->timeout_timer, &timeout, 1261 TIMEOUT_TIMER); 1262 } 1240 1263 unlock_timer(tsx); 1241 1264 … … 1250 1273 1251 1274 pj_log_pop_indent(); 1252 }1253 1254 /* Set transaction state without notifying tsx_user */1255 static void tsx_set_state_no_notify( pjsip_transaction *tsx,1256 pjsip_tsx_state_e state,1257 pjsip_event_id_e event_src_type,1258 void *event_src )1259 {1260 pjsip_module *tsx_user = tsx->tsx_user;1261 tsx->tsx_user = NULL;1262 tsx_set_state(tsx, state, event_src_type, event_src);1263 tsx->tsx_user = tsx_user;1264 1275 } 1265 1276 … … 1627 1638 if (tsx->state < PJSIP_TSX_STATE_TERMINATED) { 1628 1639 tsx_set_status_code(tsx, code, NULL); 1629 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, PJSIP_EVENT_USER, NULL); 1640 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, PJSIP_EVENT_USER, 1641 NULL, 0); 1630 1642 } 1631 1643 pj_grp_lock_release(tsx->grp_lock); … … 1838 1850 if (tsx->transport_flag & TSX_HAS_PENDING_DESTROY) { 1839 1851 tsx_set_state( tsx, PJSIP_TSX_STATE_DESTROYED, 1840 PJSIP_EVENT_UNKNOWN, NULL );1852 PJSIP_EVENT_UNKNOWN, NULL, 0 ); 1841 1853 pj_grp_lock_release(tsx->grp_lock); 1842 1854 return; … … 1913 1925 { 1914 1926 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 1915 PJSIP_EVENT_TRANSPORT_ERROR, send_state->tdata); 1927 PJSIP_EVENT_TRANSPORT_ERROR, 1928 send_state->tdata, 0); 1916 1929 } 1917 1930 /* Don't forget to destroy if we have pending destroy flag … … 1921 1934 { 1922 1935 tsx_set_state( tsx, PJSIP_TSX_STATE_DESTROYED, 1923 PJSIP_EVENT_TRANSPORT_ERROR, send_state->tdata); 1936 PJSIP_EVENT_TRANSPORT_ERROR, 1937 send_state->tdata, 0); 1924 1938 } 1925 1939 … … 2123 2137 tsx_set_status_code(tsx, PJSIP_SC_TSX_TRANSPORT_ERROR, &err); 2124 2138 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2125 PJSIP_EVENT_TRANSPORT_ERROR, NULL );2139 PJSIP_EVENT_TRANSPORT_ERROR, NULL, 0 ); 2126 2140 2127 2141 return status; … … 2355 2369 PJSIP_REQUEST_MSG); 2356 2370 tsx_set_state( tsx, PJSIP_TSX_STATE_TRYING, PJSIP_EVENT_RX_MSG, 2357 event->body.rx_msg.rdata );2371 event->body.rx_msg.rdata, 0); 2358 2372 2359 2373 } else { … … 2410 2424 /* Move state. */ 2411 2425 tsx_set_state( tsx, PJSIP_TSX_STATE_CALLING, 2412 PJSIP_EVENT_TX_MSG, tdata );2426 PJSIP_EVENT_TX_MSG, tdata, 0); 2413 2427 } 2414 2428 … … 2451 2465 /* Inform TU. */ 2452 2466 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2453 PJSIP_EVENT_TIMER, &tsx->timeout_timer );2467 PJSIP_EVENT_TIMER, &tsx->timeout_timer, 0); 2454 2468 2455 2469 /* Transaction is destroyed */ … … 2570 2584 2571 2585 tsx_set_state( tsx, PJSIP_TSX_STATE_PROCEEDING, 2572 PJSIP_EVENT_TX_MSG, event->body.tx_msg.tdata );2586 PJSIP_EVENT_TX_MSG, event->body.tx_msg.tdata, 0); 2573 2587 2574 2588 } … … 2651 2665 2652 2666 tsx_set_state( tsx, PJSIP_TSX_STATE_PROCEEDING, 2653 PJSIP_EVENT_TX_MSG, tdata );2667 PJSIP_EVENT_TX_MSG, tdata, 0 ); 2654 2668 2655 2669 /* Retransmit provisional response every 1 minute if this is … … 2685 2699 */ 2686 2700 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2687 PJSIP_EVENT_TX_MSG, tdata );2701 PJSIP_EVENT_TX_MSG, tdata, 0 ); 2688 2702 2689 2703 /* Transaction is destroyed. */ … … 2743 2757 /* Set state to "Completed" */ 2744 2758 tsx_set_state( tsx, PJSIP_TSX_STATE_COMPLETED, 2745 PJSIP_EVENT_TX_MSG, tdata );2759 PJSIP_EVENT_TX_MSG, tdata, 0 ); 2746 2760 } 2747 2761 … … 2802 2816 /* Inform TU */ 2803 2817 tsx_set_state( tsx, PJSIP_TSX_STATE_COMPLETED, 2804 PJSIP_EVENT_TX_MSG, tdata );2818 PJSIP_EVENT_TX_MSG, tdata, 0 ); 2805 2819 2806 2820 } else { … … 2836 2850 2837 2851 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2838 PJSIP_EVENT_TIMER, &tsx->timeout_timer );2852 PJSIP_EVENT_TIMER, &tsx->timeout_timer, 0); 2839 2853 2840 2854 return PJ_EBUG; … … 2901 2915 /* Inform the message to TU. */ 2902 2916 tsx_set_state( tsx, PJSIP_TSX_STATE_PROCEEDING, 2903 PJSIP_EVENT_RX_MSG, event->body.rx_msg.rdata );2917 PJSIP_EVENT_RX_MSG, event->body.rx_msg.rdata, 0 ); 2904 2918 2905 2919 } else if (PJSIP_IS_STATUS_IN_CLASS(tsx->status_code,200)) { … … 2915 2929 if (tsx->method.id == PJSIP_INVITE_METHOD) { 2916 2930 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2917 PJSIP_EVENT_RX_MSG, event->body.rx_msg.rdata );2931 PJSIP_EVENT_RX_MSG, event->body.rx_msg.rdata, 0 ); 2918 2932 //return PJSIP_ETSXDESTROYED; 2919 2933 … … 2942 2956 /* Move state to Completed, inform TU. */ 2943 2957 tsx_set_state( tsx, PJSIP_TSX_STATE_COMPLETED, 2944 PJSIP_EVENT_RX_MSG, event->body.rx_msg.rdata );2958 PJSIP_EVENT_RX_MSG, event->body.rx_msg.rdata, 0 ); 2945 2959 } 2946 2960 … … 2950 2964 /* Inform TU. */ 2951 2965 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2952 PJSIP_EVENT_TIMER, &tsx->timeout_timer );2966 PJSIP_EVENT_TIMER, &tsx->timeout_timer, 0); 2953 2967 2954 2968 … … 3041 3055 /* Inform TU. */ 3042 3056 tsx_set_state( tsx, PJSIP_TSX_STATE_COMPLETED, 3043 PJSIP_EVENT_RX_MSG, event->body.rx_msg.rdata );3057 PJSIP_EVENT_RX_MSG, event->body.rx_msg.rdata, 0); 3044 3058 3045 3059 /* Generate and send ACK for INVITE. */ … … 3152 3166 /* Move state to "Confirmed" */ 3153 3167 tsx_set_state( tsx, PJSIP_TSX_STATE_CONFIRMED, 3154 PJSIP_EVENT_RX_MSG, event->body.rx_msg.rdata );3168 PJSIP_EVENT_RX_MSG, event->body.rx_msg.rdata, 0 ); 3155 3169 } 3156 3170 … … 3176 3190 3177 3191 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 3178 PJSIP_EVENT_TIMER, &tsx->timeout_timer );3192 PJSIP_EVENT_TIMER, &tsx->timeout_timer, 0 ); 3179 3193 3180 3194 //return PJSIP_ETSXDESTROYED; … … 3183 3197 /* Transaction terminated, it can now be deleted. */ 3184 3198 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 3185 PJSIP_EVENT_TIMER, &tsx->timeout_timer );3199 PJSIP_EVENT_TIMER, &tsx->timeout_timer, 0 ); 3186 3200 //return PJSIP_ETSXDESTROYED; 3187 3201 } … … 3216 3230 /* Move to Terminated state. */ 3217 3231 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 3218 PJSIP_EVENT_TIMER, event->body.timer.entry );3232 PJSIP_EVENT_TIMER, event->body.timer.entry, 0 ); 3219 3233 3220 3234 /* Transaction has been destroyed. */ … … 3291 3305 /* Move to Terminated state. */ 3292 3306 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 3293 PJSIP_EVENT_TIMER, &tsx->timeout_timer );3307 PJSIP_EVENT_TIMER, &tsx->timeout_timer, 0 ); 3294 3308 3295 3309 /* Transaction has been destroyed. */ … … 3322 3336 /* Destroy this transaction */ 3323 3337 tsx_set_state(tsx, PJSIP_TSX_STATE_DESTROYED, 3324 event->type, event->body.user.user1 );3338 event->type, event->body.user.user1, 0 ); 3325 3339 3326 3340 return PJ_SUCCESS; -
pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c
r4537 r5241 278 278 /* 279 279 * Register new dialog. Called by pjsip_dlg_create_uac() and 280 * pjsip_dlg_create_uas ();280 * pjsip_dlg_create_uas_and_inc_lock(); 281 281 */ 282 282 PJ_DEF(pj_status_t) pjsip_ua_register_dlg( pjsip_user_agent *ua, -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r5232 r5241 983 983 pjsip_tx_data *response = NULL; 984 984 unsigned options = 0; 985 pjsip_dialog *dlg = call->async_call.dlg; 985 986 int sip_err_code = (info? info->sip_err_code: 0); 986 987 pj_status_t status = (info? info->status: PJ_SUCCESS); 987 988 988 989 PJSUA_LOCK(); 990 991 /* Increment the dialog's lock to prevent it to be destroyed prematurely, 992 * such as in case of transport error. 993 */ 994 pjsip_dlg_inc_lock(dlg); 995 996 /* Decrement dialog session. */ 997 pjsip_dlg_dec_session(dlg, &pjsua_var.mod); 989 998 990 999 if (status != PJ_SUCCESS) { … … 997 1006 pjsua_media_channel_deinit(call->index); 998 1007 call->med_ch_cb = NULL; 1008 pjsip_dlg_dec_lock(dlg); 999 1009 PJSUA_UNLOCK(); 1000 1010 return PJ_SUCCESS; … … 1068 1078 } 1069 1079 } 1070 1080 1081 pjsip_dlg_dec_lock(dlg); 1082 1071 1083 PJSUA_UNLOCK(); 1072 1084 return status; … … 1352 1364 1353 1365 /* Create dialog: */ 1354 status = pjsip_dlg_create_uas ( pjsip_ua_instance(), rdata,1355 &contact, &dlg);1366 status = pjsip_dlg_create_uas_and_inc_lock( pjsip_ua_instance(), rdata, 1367 &contact, &dlg); 1356 1368 if (status != PJ_SUCCESS) { 1357 1369 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, … … 1460 1472 call->async_call.dlg = dlg; 1461 1473 pj_list_init(&call->async_call.call_var.inc_call.answers); 1474 1475 pjsip_dlg_inc_session(dlg, &pjsua_var.mod); 1462 1476 1463 1477 /* Init media channel, only when there is offer or call replace request. … … 1502 1516 pjsip_dlg_dec_lock(dlg); 1503 1517 1518 pjsip_dlg_dec_session(dlg, &pjsua_var.mod); 1519 1504 1520 call->inv = NULL; 1505 1521 call->async_call.dlg = NULL; … … 1619 1635 /* This INVITE request has been handled. */ 1620 1636 on_return: 1637 if (dlg) { 1638 pjsip_dlg_dec_lock(dlg); 1639 } 1640 1621 1641 pj_log_pop_indent(); 1622 1642 PJSUA_UNLOCK(); -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r5170 r5241 1106 1106 1107 1107 for (ii=0; ii<pjsua_var.ua_cfg.thread_cnt; ++ii) { 1108 status = pj_thread_create(pjsua_var.pool, "pjsua", &worker_thread, 1108 char thread_name[16]; 1109 pj_ansi_snprintf(thread_name, 16, "pjsua_%d", ii); 1110 status = pj_thread_create(pjsua_var.pool, thread_name, &worker_thread, 1109 1111 NULL, 0, 0, &pjsua_var.thread[ii]); 1110 1112 if (status != PJ_SUCCESS) -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
r5224 r5241 856 856 857 857 /* Create UAS dialog: */ 858 status = pjsip_dlg_create_uas (pjsip_ua_instance(), rdata,859 &contact, &dlg);858 status = pjsip_dlg_create_uas_and_inc_lock(pjsip_ua_instance(), rdata, 859 &contact, &dlg); 860 860 if (status != PJ_SUCCESS) { 861 861 pjsua_perror(THIS_FILE, … … 922 922 } 923 923 924 pjsip_dlg_dec_lock(dlg); 924 925 PJSUA_UNLOCK(); 925 926 pj_log_pop_indent(); 926 927 return PJ_TRUE; 927 928 } 929 930 /* Subscription has been created, decrement & release dlg lock */ 931 pjsip_dlg_dec_lock(dlg); 928 932 929 933 /* If account is locked to specific transport, then lock dialog … … 1036 1040 1037 1041 /* Done: */ 1038 1039 1042 PJSUA_UNLOCK(); 1040 1043 pj_log_pop_indent(); -
pjproject/trunk/pjsip/src/test/inv_offer_answer_test.c
r3553 r5241 309 309 */ 310 310 uri = pj_str(CONTACT); 311 status = pjsip_dlg_create_uas (pjsip_ua_instance(), rdata,312 311 status = pjsip_dlg_create_uas_and_inc_lock(pjsip_ua_instance(), rdata, 312 &uri, &dlg); 313 313 pj_assert(status == PJ_SUCCESS); 314 314 … … 322 322 status = pjsip_inv_create_uas(dlg, rdata, sdp, inv_test.param.inv_option, &inv_test.uas); 323 323 pj_assert(status == PJ_SUCCESS); 324 pjsip_dlg_dec_lock(dlg); 324 325 325 326 TRACE_((THIS_FILE, " Sending 183 with SDP"));
Note: See TracChangeset
for help on using the changeset viewer.