Changeset 3977


Ignore:
Timestamp:
Mar 15, 2012 9:37:19 AM (12 years ago)
Author:
nanang
Message:

Fix #1464: Only use PJSUA lock in PJSUA implementations of INVITE session callbacks when updating 'pjsua_var' is needed, while updating 'pjsua_call' should be enough with call/dialog lock (which is actually being held by the INVITE session layer during invoking its callback).

File:
1 edited

Legend:

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

    r3954 r3977  
    33313331    pjsua_call *call; 
    33323332 
    3333     PJSUA_LOCK(); 
    3334  
    33353333    call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; 
    33363334 
    33373335    if (!call) { 
    3338         PJSUA_UNLOCK(); 
    33393336        return; 
    33403337    } 
     
    34783475    if (inv->state == PJSIP_INV_STATE_DISCONNECTED) { 
    34793476 
    3480         pj_assert(call != NULL); 
    3481  
    3482         if (call) 
    3483             pjsua_media_channel_deinit(call->index); 
     3477        PJSUA_LOCK(); 
     3478         
     3479        pjsua_media_channel_deinit(call->index); 
    34843480 
    34853481        /* Free call */ 
    34863482        call->inv = NULL; 
     3483 
     3484        pj_assert(pjsua_var.call_cnt > 0); 
    34873485        --pjsua_var.call_cnt; 
    34883486 
     
    34903488        reset_call(call->index); 
    34913489 
    3492     } 
    3493  
    3494     PJSUA_UNLOCK(); 
     3490        PJSUA_UNLOCK(); 
     3491    } 
    34953492} 
    34963493 
     
    35993596    //const pj_str_t st_update = {"UPDATE", 6}; 
    36003597 
    3601     PJSUA_LOCK(); 
    3602  
    36033598    call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; 
    36043599 
     
    36243619        } 
    36253620 
    3626         PJSUA_UNLOCK(); 
    36273621        return; 
    36283622    } 
     
    36363630                     status); 
    36373631        //call_disconnect(inv, PJSIP_SC_UNSUPPORTED_MEDIA_TYPE); 
    3638         PJSUA_UNLOCK(); 
    36393632        return; 
    36403633    } 
     
    36463639                     status); 
    36473640        //call_disconnect(inv, PJSIP_SC_UNSUPPORTED_MEDIA_TYPE); 
    3648         PJSUA_UNLOCK(); 
    36493641        return; 
    36503642    } 
     
    36653657         */ 
    36663658        /*pjsua_media_channel_deinit(call->index);*/ 
    3667         PJSUA_UNLOCK(); 
    36683659        return; 
    36693660    } 
     
    36783669    if (pjsua_var.ua_cfg.cb.on_call_media_state) 
    36793670        pjsua_var.ua_cfg.cb.on_call_media_state(call->index); 
    3680  
    3681  
    3682     PJSUA_UNLOCK(); 
    36833671} 
    36843672 
     
    37903778    pj_status_t status; 
    37913779 
    3792     PJSUA_LOCK(); 
    3793  
    37943780    call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; 
    37953781 
     
    38033789    if (status != PJ_SUCCESS) { 
    38043790        pjsua_perror(THIS_FILE, "Unable to create local SDP", status); 
    3805         PJSUA_UNLOCK(); 
    38063791        return; 
    38073792    } 
     
    38293814    if (status != PJ_SUCCESS) { 
    38303815        pjsua_perror(THIS_FILE, "Unable to set answer", status); 
    3831         PJSUA_UNLOCK(); 
    38323816        return; 
    38333817    } 
    3834  
    3835     PJSUA_UNLOCK(); 
    38363818} 
    38373819 
     
    38453827    pjsua_call *call; 
    38463828    pj_status_t status; 
    3847  
    3848     PJSUA_LOCK(); 
    38493829 
    38503830    call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; 
     
    38673847    if (status != PJ_SUCCESS) { 
    38683848        pjsua_perror(THIS_FILE, "Unable to create local SDP", status); 
    3869         PJSUA_UNLOCK(); 
    38703849        return; 
    38713850    } 
    3872  
    3873     PJSUA_UNLOCK(); 
    38743851} 
    38753852 
     
    43084285    pjsua_call *call; 
    43094286 
    4310     PJSUA_LOCK(); 
    4311  
    43124287    call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; 
    43134288 
    43144289    if (call == NULL) { 
    4315         PJSUA_UNLOCK(); 
    43164290        return; 
    43174291    } 
     
    43234297         * receive another REFER for this call. 
    43244298         */ 
    4325         PJSUA_UNLOCK(); 
    43264299        return; 
    43274300    } 
     
    43354308        tsx->last_tx && tsx->last_tx->auth_retry) 
    43364309    { 
    4337         PJSUA_UNLOCK(); 
    43384310        return; 
    43394311    } 
     
    43814353            pjsip_dlg_respond( inv->dlg, rdata, PJSIP_SC_NOT_ACCEPTABLE_HERE,  
    43824354                               NULL, &hdr_list, NULL ); 
    4383             PJSUA_UNLOCK(); 
    43844355            return; 
    43854356        } 
     
    44284399        } 
    44294400    } 
    4430  
    4431  
    4432  
    4433     PJSUA_UNLOCK(); 
    44344401} 
    44354402 
     
    44424409    pjsua_call *call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; 
    44434410    pjsip_redirect_op op; 
    4444  
    4445     PJSUA_LOCK(); 
    44464411 
    44474412    if (pjsua_var.ua_cfg.cb.on_call_redirected) { 
     
    44564421    } 
    44574422 
    4458     PJSUA_UNLOCK(); 
    4459  
    44604423    return op; 
    44614424} 
Note: See TracChangeset for help on using the changeset viewer.