Changeset 4448


Ignore:
Timestamp:
Mar 21, 2013 11:38:05 AM (6 years ago)
Author:
bennylp
Message:

More on re #1646: added flag to prevent another transmit data from being transmitted while we are waiting for the previous one to be flushed from transport queue

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_transaction.c

    r4446 r4448  
    19211921    pjsip_transaction *tsx = (pjsip_transaction*) token; 
    19221922 
     1923    /* In other circumstances, locking tsx->grp_lock AFTER transport mutex 
     1924     * will introduce deadlock if another thread is currently sending a 
     1925     * SIP message to the transport. But this should be safe as there should 
     1926     * be no way this callback could be called while another thread is 
     1927     * sending a message. 
     1928     */ 
     1929    pj_grp_lock_acquire(tsx->grp_lock); 
     1930    tsx->transport_flag &= ~(TSX_HAS_PENDING_TRANSPORT); 
     1931    pj_grp_lock_release(tsx->grp_lock); 
     1932 
    19231933    if (sent < 0) { 
    19241934        pj_time_val delay = {0, 0}; 
    19251935        char errmsg[PJ_ERR_MSG_SIZE]; 
    1926         pj_str_t err; 
    1927  
    1928         err = pj_strerror(-sent, errmsg, sizeof(errmsg)); 
     1936 
     1937        pj_strerror(-sent, errmsg, sizeof(errmsg)); 
    19291938 
    19301939        PJ_LOG(2,(tsx->obj_name, "Transport failed to send %s! Err=%d (%s)", 
     
    20022011         */ 
    20032012        pj_grp_lock_add_ref(tsx->grp_lock); 
     2013        tsx->transport_flag |= TSX_HAS_PENDING_TRANSPORT; 
    20042014 
    20052015        status = pjsip_transport_send( tsx->transport, tdata, &tsx->addr, 
     
    20102020        else { 
    20112021            /* Operation completes immediately */ 
     2022            tsx->transport_flag &= ~(TSX_HAS_PENDING_TRANSPORT); 
    20122023            pj_grp_lock_dec_ref(tsx->grp_lock); 
    20132024        } 
Note: See TracChangeset for help on using the changeset viewer.