Changeset 3751 for pjproject


Ignore:
Timestamp:
Sep 16, 2011 3:12:27 AM (13 years ago)
Author:
bennylp
Message:

Fixed #1371: Soft deadlock when application query call info of other call inside a callback. The following APIs should be safe to be called in this situation:

  • pjsua_call_get_info()
  • pjsua_call_get_conf_port()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.x/pjsip/src/pjsua-lib/pjsua_call.c

    r3749 r3751  
    12431243    pjsua_call *call; 
    12441244    pjsua_conf_port_id port_id; 
    1245     pjsip_dialog *dlg; 
    1246     pj_status_t status; 
    12471245 
    12481246    PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls,  
    12491247                     PJ_EINVAL); 
    12501248 
    1251     status = acquire_call("pjsua_call_get_conf_port()", call_id, &call, &dlg); 
    1252     if (status != PJ_SUCCESS) 
    1253         return PJSUA_INVALID_ID; 
    1254  
     1249    /* Use PJSUA_LOCK() instead of acquire_call(): 
     1250     *  https://trac.pjsip.org/repos/ticket/1371 
     1251     */ 
     1252    PJSUA_LOCK(); 
     1253 
     1254    call = &pjsua_var.calls[call_id]; 
    12551255    port_id = call->conf_slot; 
    12561256 
    1257     pjsip_dlg_dec_lock(dlg); 
     1257    PJSUA_UNLOCK(); 
    12581258 
    12591259    return port_id; 
     
    12691269{ 
    12701270    pjsua_call *call; 
    1271     pjsip_dialog *dlg; 
    1272     pj_status_t status; 
    12731271 
    12741272    PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 
     
    12771275    pj_bzero(info, sizeof(*info)); 
    12781276 
    1279     status = acquire_call("pjsua_call_get_info()", call_id, &call, &dlg); 
    1280     if (status != PJ_SUCCESS) { 
    1281         return status; 
    1282     } 
     1277    /* Use PJSUA_LOCK() instead of acquire_call(): 
     1278     *  https://trac.pjsip.org/repos/ticket/1371 
     1279     */ 
     1280    PJSUA_LOCK(); 
     1281 
     1282    call = &pjsua_var.calls[call_id]; 
    12831283 
    12841284    /* id and role */ 
     
    13761376    } 
    13771377 
    1378     pjsip_dlg_dec_lock(dlg); 
     1378    PJSUA_UNLOCK(); 
    13791379 
    13801380    return PJ_SUCCESS; 
Note: See TracChangeset for help on using the changeset viewer.