Ignore:
Timestamp:
Oct 16, 2006 8:05:27 PM (18 years ago)
Author:
bennylp
Message:

Fixed bug in client registration when pjsip_endpt_send_request() returns immediate error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c

    r714 r776  
    582582        } 
    583583 
     584        /* Increment pending_tsx temporarily to prevent regc from 
     585         * being destroyed. 
     586         */ 
     587        ++regc->pending_tsx; 
    584588 
    585589        /* Call callback. */ 
     
    591595                      contact_cnt, contact); 
    592596 
     597        /* Decrement pending_tsx */ 
     598        --regc->pending_tsx; 
    593599    } 
    594600 
     
    624630     * may be called even before send_request() returns! 
    625631     */ 
    626     ++regc->pending_tsx; 
     632    regc->pending_tsx += 2; 
    627633    status = pjsip_endpt_send_request(regc->endpt, tdata, -1, regc, &tsx_callback); 
    628634    if (status!=PJ_SUCCESS) { 
    629         --regc->pending_tsx; 
    630635        PJ_LOG(4,(THIS_FILE, "Error sending request, status=%d", status)); 
    631636    } 
     637    --regc->pending_tsx; 
     638 
     639    /* Delete the record if user destroy regc during the callback. */ 
     640    if (regc->_delete_flag && regc->pending_tsx==0) { 
     641        pjsip_regc_destroy(regc); 
     642    } 
    632643 
    633644    return status; 
Note: See TracChangeset for help on using the changeset viewer.