Changeset 908 for pjproject


Ignore:
Timestamp:
Jan 26, 2007 5:13:56 PM (18 years ago)
Author:
bennylp
Message:

Fixed ticket #81: registration refresh crashed when NIC is plugged-off

File:
1 edited

Legend:

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

    r891 r908  
    526526 
    527527 
     528    if (!regc->cb) 
     529        return; 
     530 
    528531    cbparam.regc = regc; 
    529532    cbparam.token = regc->token; 
     
    551554    PJ_UNUSED_ARG(timer_heap); 
    552555 
     556    /* Temporarily increase busy flag to prevent regc from being deleted 
     557     * in pjsip_regc_send() 
     558     */ 
     559    regc->busy++; 
     560 
    553561    entry->id = 0; 
    554562    status = pjsip_regc_register(regc, 1, &tdata); 
     
    557565    }  
    558566     
    559     if (status != PJ_SUCCESS) { 
     567    if (status != PJ_SUCCESS && regc->cb) { 
    560568        char errmsg[PJ_ERR_MSG_SIZE]; 
    561569        pj_str_t reason = pj_strerror(status, errmsg, sizeof(errmsg)); 
    562570        call_callback(regc, status, 400, &reason, NULL, -1, 0, NULL); 
     571    } 
     572 
     573    regc->busy--; 
     574 
     575    /* Delete the record if user destroy regc during the callback. */ 
     576    if (regc->_delete_flag && regc->busy==0) { 
     577        pjsip_regc_destroy(regc); 
    563578    } 
    564579} 
Note: See TracChangeset for help on using the changeset viewer.