Ignore:
Timestamp:
Nov 4, 2014 8:00:15 AM (6 years ago)
Author:
nanang
Message:

Close #1802: Configurable randomized value range for auto re-registration interval.

File:
1 edited

Legend:

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

    r4955 r4957  
    12051205    acc->cfg.reg_retry_interval = cfg->reg_retry_interval; 
    12061206    acc->cfg.reg_first_retry_interval = cfg->reg_first_retry_interval; 
     1207    acc->cfg.reg_retry_random_interval = cfg->reg_retry_random_interval;     
    12071208    acc->cfg.drop_calls_on_reg_fail = cfg->drop_calls_on_reg_fail; 
    12081209    acc->cfg.register_on_acc_add = cfg->register_on_acc_add; 
     
    35403541    delay.msec = 0; 
    35413542 
    3542     /* Randomize interval by +/- 10 secs */ 
    3543     if (delay.sec >= 10) { 
    3544         delay.msec = -10000 + (pj_rand() % 20000); 
    3545     } else { 
    3546         delay.sec = 0; 
    3547         delay.msec = (pj_rand() % 10000); 
     3543    /* Randomize interval by +/- reg_retry_random_interval, if configured */ 
     3544    if (acc->cfg.reg_retry_random_interval) { 
     3545        long rand_ms = acc->cfg.reg_retry_random_interval * 1000; 
     3546        if (delay.sec >= (long)acc->cfg.reg_retry_random_interval) { 
     3547            delay.msec = -rand_ms + (pj_rand() % (rand_ms * 2)); 
     3548        } else { 
     3549            delay.sec = 0; 
     3550            delay.msec = (pj_rand() % (delay.sec * 1000 + rand_ms)); 
     3551        } 
    35483552    } 
    35493553    pj_time_val_normalize(&delay); 
Note: See TracChangeset for help on using the changeset viewer.