Changeset 4983


Ignore:
Timestamp:
Feb 13, 2015 11:34:26 AM (6 years ago)
Author:
ming
Message:

Fixed #1815: Race condition of STUN transaction destruction

Location:
pjproject/trunk/pjnath
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/include/pjnath/stun_transaction.h

    r4360 r4983  
    163163 
    164164/** 
     165 * Destroy the STUN transaction immediately after the transaction is complete. 
     166 * Application normally calls this function in the on_complete() callback. 
     167 * 
     168 * @param tsx           The STUN transaction. 
     169 * 
     170 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     171 */ 
     172PJ_DECL(pj_status_t) pj_stun_client_tsx_destroy(pj_stun_client_tsx *tsx); 
     173 
     174 
     175/** 
    165176 * Stop the client transaction. 
    166177 * 
  • pjproject/trunk/pjnath/src/pjnath/stun_session.c

    r4606 r4983  
    150150    pj_stun_client_tsx_stop(tsx); 
    151151    if (tdata) { 
    152         tsx_erase(tdata->sess, tdata); 
     152        pj_stun_session *sess = tdata->sess; 
     153         
     154        pj_grp_lock_acquire(sess->grp_lock); 
     155        tsx_erase(sess, tdata); 
    153156        pj_pool_release(tdata->pool); 
    154     } 
     157        pj_grp_lock_release(sess->grp_lock); 
     158    } 
     159 
     160    pj_stun_client_tsx_destroy(tsx); 
    155161 
    156162    TRACE_((THIS_FILE, "STUN transaction %p destroyed", tsx)); 
  • pjproject/trunk/pjnath/src/pjnath/stun_transaction.c

    r4717 r4983  
    139139 
    140140 
     141PJ_DEF(pj_status_t) pj_stun_client_tsx_destroy(pj_stun_client_tsx *tsx) 
     142{ 
     143    /* 
     144     * Currently tsx has no objects to destroy so we don't need to do anything 
     145     * here. 
     146     */ 
     147    /* pj_stun_client_tsx_stop(tsx); */ 
     148    return PJ_SUCCESS; 
     149} 
     150 
    141151/* 
    142152 * Destroy transaction immediately. 
Note: See TracChangeset for help on using the changeset viewer.