Changeset 5111 for pjproject/trunk


Ignore:
Timestamp:
Jun 19, 2015 2:43:34 PM (9 years ago)
Author:
nanang
Message:

Fixed #1859: Increment tsx group lock counter before send operation and decrement later in tsx's send_msg_callback() to avoid tsx premature destroy.

File:
1 edited

Legend:

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

    r4992 r5111  
    17961796    { 
    17971797        *cont = PJ_FALSE; 
     1798 
     1799        /* Decrease pending send counter */ 
     1800        pj_grp_lock_dec_ref(tsx->grp_lock); 
    17981801        return; 
    17991802    } 
    18001803 
    18011804    pj_grp_lock_acquire(tsx->grp_lock); 
     1805 
     1806    /* Decrease pending send counter */ 
     1807    pj_grp_lock_dec_ref(tsx->grp_lock); 
    18021808 
    18031809    /* Reset */ 
     
    19331939            tdata->mod_data[mod_tsx_layer.mod.id] = tsx; 
    19341940            tsx->pending_tx = tdata; 
     1941 
     1942            /* Increment group lock again for the next sending retry, 
     1943             * to prevent us from being destroyed prematurely (ticket #1859). 
     1944             */ 
     1945            pj_grp_lock_add_ref(tsx->grp_lock); 
    19351946        } 
    19361947    } 
     
    21232134    tsx->pending_tx = tdata; 
    21242135 
     2136    /* Increment group lock while waiting for send operation to complete, 
     2137     * to prevent us from being destroyed prematurely (ticket #1859). 
     2138     */ 
     2139    pj_grp_lock_add_ref(tsx->grp_lock); 
     2140 
    21252141    /* Begin resolving destination etc to send the message. */ 
    21262142    if (tdata->msg->type == PJSIP_REQUEST_MSG) { 
     
    21322148            status = PJ_SUCCESS; 
    21332149        if (status != PJ_SUCCESS) { 
     2150            pj_grp_lock_dec_ref(tsx->grp_lock); 
    21342151            pjsip_tx_data_dec_ref(tdata); 
    21352152            tdata->mod_data[mod_tsx_layer.mod.id] = NULL; 
Note: See TracChangeset for help on using the changeset viewer.