Changeset 4155


Ignore:
Timestamp:
Jun 5, 2012 11:49:43 AM (9 years ago)
Author:
bennylp
Message:

Re #1527: fixed bug in pjsua-lib, where registration operation may cause wrong timer entry (with _timer_id=0) to be cancelled accidentally. This could happen when turning registration ON after it was off. Thanks Itay Bianco for the report

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c

    r4130 r4155  
    599599 
    600600    /* Cancel any re-registration timer */ 
    601     pjsua_cancel_timer(&acc->auto_rereg.timer); 
     601    if (acc->auto_rereg.timer.id) { 
     602        acc->auto_rereg.timer.id = PJ_FALSE; 
     603        pjsua_cancel_timer(&acc->auto_rereg.timer); 
     604    } 
    602605 
    603606    /* Delete registration */ 
     
    21072110 
    21082111    /* Cancel any re-registration timer */ 
    2109     pjsua_cancel_timer(&pjsua_var.acc[acc_id].auto_rereg.timer); 
     2112    if (pjsua_var.acc[acc_id].auto_rereg.timer.id) { 
     2113        pjsua_var.acc[acc_id].auto_rereg.timer.id = PJ_FALSE; 
     2114        pjsua_cancel_timer(&pjsua_var.acc[acc_id].auto_rereg.timer); 
     2115    } 
    21102116 
    21112117    /* Reset pointer to registration transport */ 
     
    29062912 
    29072913    /* Cancel any re-registration timer */ 
    2908     pjsua_cancel_timer(&acc->auto_rereg.timer); 
     2914    if (acc->auto_rereg.timer.id) { 
     2915        acc->auto_rereg.timer.id = PJ_FALSE; 
     2916        pjsua_cancel_timer(&acc->auto_rereg.timer); 
     2917    } 
    29092918 
    29102919    /* Update re-registration flag */ 
     
    29332942              acc->index, delay.sec)); 
    29342943 
    2935     pjsua_schedule_timer(&acc->auto_rereg.timer, &delay); 
     2944    acc->auto_rereg.timer.id = PJ_TRUE; 
     2945    if (pjsua_schedule_timer(&acc->auto_rereg.timer, &delay) != PJ_SUCCESS) 
     2946        acc->auto_rereg.timer.id = PJ_FALSE; 
    29362947} 
    29372948 
Note: See TracChangeset for help on using the changeset viewer.