Ignore:
Timestamp:
Feb 5, 2016 4:29:17 AM (8 years ago)
Author:
nanang
Message:

Fixed #1902:

  • Crash when endpoint has multiple worker threads and SIP TCP transport is disconnected during incoming call handling.
  • Deprecated pjsip_dlg_create_uas(), replaced by pjsip_dlg_create_uas_and_inc_lock().
  • Serialized transaction state notifications (of 'terminated' and 'destroyed') in case of transport error.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r5232 r5241  
    983983    pjsip_tx_data *response = NULL; 
    984984    unsigned options = 0; 
     985    pjsip_dialog *dlg = call->async_call.dlg; 
    985986    int sip_err_code = (info? info->sip_err_code: 0); 
    986987    pj_status_t status = (info? info->status: PJ_SUCCESS); 
    987988 
    988989    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);     
    989998 
    990999    if (status != PJ_SUCCESS) { 
     
    9971006        pjsua_media_channel_deinit(call->index); 
    9981007        call->med_ch_cb = NULL; 
     1008        pjsip_dlg_dec_lock(dlg); 
    9991009        PJSUA_UNLOCK(); 
    10001010        return PJ_SUCCESS; 
     
    10681078        } 
    10691079    } 
    1070  
     1080     
     1081    pjsip_dlg_dec_lock(dlg); 
     1082     
    10711083    PJSUA_UNLOCK(); 
    10721084    return status; 
     
    13521364 
    13531365    /* 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); 
    13561368    if (status != PJ_SUCCESS) { 
    13571369        pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, 
     
    14601472    call->async_call.dlg = dlg; 
    14611473    pj_list_init(&call->async_call.call_var.inc_call.answers); 
     1474 
     1475    pjsip_dlg_inc_session(dlg, &pjsua_var.mod); 
    14621476 
    14631477    /* Init media channel, only when there is offer or call replace request. 
     
    15021516            pjsip_dlg_dec_lock(dlg); 
    15031517 
     1518            pjsip_dlg_dec_session(dlg, &pjsua_var.mod); 
     1519 
    15041520            call->inv = NULL; 
    15051521            call->async_call.dlg = NULL; 
     
    16191635    /* This INVITE request has been handled. */ 
    16201636on_return: 
     1637    if (dlg) { 
     1638        pjsip_dlg_dec_lock(dlg); 
     1639    } 
     1640     
    16211641    pj_log_pop_indent(); 
    16221642    PJSUA_UNLOCK(); 
Note: See TracChangeset for help on using the changeset viewer.