Changeset 2419 for pjproject/trunk


Ignore:
Timestamp:
Jan 12, 2009 10:06:04 AM (15 years ago)
Author:
bennylp
Message:

Fixed ticket #689: Deadlock caused by ICE media transport (thanks Alain Totouom for the report)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/src/pjnath/ice_session.c

    r2394 r2419  
    24582458    pj_ice_msg_data *msg_data = NULL; 
    24592459    unsigned i; 
    2460     pj_status_t stun_status; 
    24612460 
    24622461    PJ_ASSERT_RETURN(ice, PJ_EINVAL); 
     
    24662465    comp = find_comp(ice, comp_id); 
    24672466    if (comp == NULL) { 
    2468         status = PJNATH_EICEINCOMPID; 
    2469         goto on_return; 
     2467        pj_mutex_unlock(ice->mutex); 
     2468        return PJNATH_EICEINCOMPID; 
    24702469    } 
    24712470 
     
    24792478    if (msg_data == NULL) { 
    24802479        pj_assert(!"Invalid transport ID"); 
    2481         status = PJ_EINVAL; 
    2482         goto on_return; 
    2483     } 
    2484  
    2485     stun_status = pj_stun_msg_check((const pj_uint8_t*)pkt, pkt_size,  
    2486                                     PJ_STUN_IS_DATAGRAM); 
    2487     if (stun_status == PJ_SUCCESS) { 
     2480        pj_mutex_unlock(ice->mutex); 
     2481        return PJ_EINVAL; 
     2482    } 
     2483 
     2484    status = pj_stun_msg_check((const pj_uint8_t*)pkt, pkt_size,  
     2485                               PJ_STUN_IS_DATAGRAM); 
     2486    if (status == PJ_SUCCESS) { 
    24882487        status = pj_stun_session_on_rx_pkt(comp->stun_sess, pkt, pkt_size, 
    24892488                                           PJ_STUN_IS_DATAGRAM, msg_data, 
     
    24942493                  ice->tmp.errmsg)); 
    24952494        } 
     2495        pj_mutex_unlock(ice->mutex); 
    24962496    } else { 
     2497        /* Not a STUN packet. Call application's callback instead, but release 
     2498         * the mutex now or otherwise we may get deadlock. 
     2499         */ 
     2500        pj_mutex_unlock(ice->mutex); 
     2501 
    24972502        (*ice->cb.on_rx_data)(ice, comp_id, transport_id, pkt, pkt_size,  
    24982503                              src_addr, src_addr_len); 
    2499     } 
    2500      
    2501  
    2502 on_return: 
    2503     pj_mutex_unlock(ice->mutex); 
     2504        status = PJ_SUCCESS; 
     2505    } 
     2506 
    25042507    return status; 
    25052508} 
Note: See TracChangeset for help on using the changeset viewer.