Changeset 3951


Ignore:
Timestamp:
Feb 8, 2012 9:29:38 AM (13 years ago)
Author:
nanang
Message:

Fix #1451: Don't hold the ICE session's mutex when calling pj_ice_sess_cb::on_tx_pkt() callback to avoid deadlock.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.x/pjnath/src/pjnath/ice_session.c

    r3553 r3951  
    28242824    pj_ice_sess_comp *comp; 
    28252825    pj_ice_sess_cand *cand; 
     2826    pj_uint8_t transport_id; 
     2827    pj_sockaddr addr; 
    28262828 
    28272829    PJ_ASSERT_RETURN(ice && comp_id, PJ_EINVAL); 
     
    28392841    if (comp == NULL) { 
    28402842        status = PJNATH_EICEINCOMPID; 
     2843        pj_mutex_unlock(ice->mutex); 
    28412844        goto on_return; 
    28422845    } 
     
    28442847    if (comp->valid_check == NULL) { 
    28452848        status = PJNATH_EICEINPROGRESS; 
     2849        pj_mutex_unlock(ice->mutex); 
    28462850        goto on_return; 
    28472851    } 
    28482852 
    28492853    cand = comp->valid_check->lcand; 
    2850     status = (*ice->cb.on_tx_pkt)(ice, comp_id, cand->transport_id,  
     2854    transport_id = cand->transport_id; 
     2855    pj_sockaddr_cp(&addr, &comp->valid_check->rcand->addr); 
     2856 
     2857    /* Release the mutex now to avoid deadlock (see ticket #1451). */ 
     2858    pj_mutex_unlock(ice->mutex); 
     2859 
     2860    status = (*ice->cb.on_tx_pkt)(ice, comp_id, transport_id,  
    28512861                                  data, data_len,  
    2852                                   &comp->valid_check->rcand->addr,  
     2862                                  &addr,  
    28532863                                  sizeof(pj_sockaddr_in)); 
    28542864 
    28552865on_return: 
    2856     pj_mutex_unlock(ice->mutex); 
    28572866    return status; 
    28582867} 
Note: See TracChangeset for help on using the changeset viewer.