Changeset 3762


Ignore:
Timestamp:
Sep 21, 2011 7:38:22 AM (13 years ago)
Author:
bennylp
Message:

Added option to control first re-registration retry interval. This closes #1375

Location:
pjproject/branches/1.x/pjsip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.x/pjsip/include/pjsua-lib/pjsua.h

    r3594 r3762  
    25202520     * Specify interval of auto registration retry upon registration failure 
    25212521     * (including caused by transport problem), in second. Set to 0 to 
    2522      * disable auto re-registration. 
     2522     * disable auto re-registration. Note that if the registration retry 
     2523     * occurs because of transport failure, the first retry will be done 
     2524     * after \a reg_first_retry_interval seconds instead. Also note that 
     2525     * the interval will be randomized slightly by approximately +/- ten 
     2526     * seconds to avoid all clients re-registering at the same time. 
     2527     * 
     2528     * See also \a reg_first_retry_interval setting. 
    25232529     * 
    25242530     * Default: #PJSUA_REG_RETRY_INTERVAL 
    25252531     */ 
    25262532    unsigned         reg_retry_interval; 
     2533 
     2534    /** 
     2535     * This specifies the interval for the first registration retry. The 
     2536     * registration retry is explained in \a reg_retry_interval. Note that 
     2537     * the value here will also be randomized by +/- ten seconds. 
     2538     * 
     2539     * Default: 0 
     2540     */ 
     2541    unsigned         reg_first_retry_interval; 
    25272542 
    25282543    /** 
  • pjproject/branches/1.x/pjsip/src/pjsua-lib/pjsua_acc.c

    r3742 r3762  
    27532753 
    27542754    /* Reregistration attempt. The first attempt will be done immediately. */ 
    2755     delay.sec = acc->auto_rereg.attempt_cnt? acc->cfg.reg_retry_interval : 0; 
     2755    delay.sec = acc->auto_rereg.attempt_cnt? acc->cfg.reg_retry_interval : 
     2756                                             acc->cfg.reg_first_retry_interval; 
    27562757    delay.msec = 0; 
     2758 
     2759    /* Randomize interval by +/- 10 secs */ 
     2760    if (delay.sec >= 10) { 
     2761        delay.msec = -10000 + (pj_rand() % 20000); 
     2762    } else { 
     2763        delay.sec = 0; 
     2764        delay.msec = (pj_rand() % 10000); 
     2765    } 
     2766    pj_time_val_normalize(&delay); 
     2767 
    27572768    pjsua_schedule_timer(&acc->auto_rereg.timer, &delay); 
    27582769} 
Note: See TracChangeset for help on using the changeset viewer.