Changeset 4957
- Timestamp:
- Nov 4, 2014 8:00:15 AM (10 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r4955 r4957 3293 3293 * occurs because of transport failure, the first retry will be done 3294 3294 * after \a reg_first_retry_interval seconds instead. Also note that 3295 * the interval will be randomized slightly by approximately +/- ten 3296 * seconds to avoid all clients re-registering at the same time. 3295 * the interval will be randomized slightly by some seconds (specified 3296 * in \a reg_retry_random_interval) to avoid all clients re-registering 3297 * at the same time. 3297 3298 * 3298 3299 * See also \a reg_first_retry_interval setting. … … 3305 3306 * This specifies the interval for the first registration retry. The 3306 3307 * registration retry is explained in \a reg_retry_interval. Note that 3307 * the value here will also be randomized by +/- ten seconds. 3308 * the value here will also be randomized by some seconds (specified 3309 * in \a reg_retry_random_interval) to avoid all clients re-registering 3310 * at the same time. 3308 3311 * 3309 3312 * Default: 0 3310 3313 */ 3311 3314 unsigned reg_first_retry_interval; 3315 3316 /** 3317 * This specifies maximum randomized value to be added/substracted 3318 * to/from the registration retry interval specified in \a 3319 * reg_retry_interval and \a reg_first_retry_interval, in second. 3320 * This is useful to avoid all clients re-registering at the same time. 3321 * For example, if the registration retry interval is set to 100 seconds 3322 * and this is set to 10 seconds, the actual registration retry interval 3323 * will be in the range of 90 to 110 seconds. 3324 * 3325 * Default: 10 3326 */ 3327 unsigned reg_retry_random_interval; 3312 3328 3313 3329 /** -
pjproject/trunk/pjsip/include/pjsua2/account.hpp
r4939 r4957 82 82 * occurs because of transport failure, the first retry will be done 83 83 * after \a firstRetryIntervalSec seconds instead. Also note that 84 * the interval will be randomized slightly by approximately +/- ten 85 * seconds to avoid all clients re-registering at the same time. 86 * 87 * See also \a firstRetryIntervalSec setting. 84 * the interval will be randomized slightly by some seconds (specified 85 * in \a reg_retry_random_interval) to avoid all clients re-registering 86 * at the same time. 87 * 88 * See also \a firstRetryIntervalSec and \a randomRetryIntervalSec 89 * settings. 88 90 * 89 91 * Default: PJSUA_REG_RETRY_INTERVAL … … 94 96 * This specifies the interval for the first registration retry. The 95 97 * registration retry is explained in \a retryIntervalSec. Note that 96 * the value here will also be randomized by +/- ten seconds. 98 * the value here will also be randomized by some seconds (specified 99 * in \a reg_retry_random_interval) to avoid all clients re-registering 100 * at the same time. 101 * 102 * See also \a retryIntervalSec and \a randomRetryIntervalSec settings. 97 103 * 98 104 * Default: 0 99 105 */ 100 106 unsigned firstRetryIntervalSec; 107 108 /** 109 * This specifies maximum randomized value to be added/substracted 110 * to/from the registration retry interval specified in \a 111 * reg_retry_interval and \a reg_first_retry_interval, in second. 112 * This is useful to avoid all clients re-registering at the same time. 113 * For example, if the registration retry interval is set to 100 seconds 114 * and this is set to 10 seconds, the actual registration retry interval 115 * will be in the range of 90 to 110 seconds. 116 * 117 * See also \a retryIntervalSec and \a firstRetryIntervalSec settings. 118 * 119 * Default: 10 120 */ 121 unsigned randomRetryIntervalSec; 101 122 102 123 /** -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r4955 r4957 1205 1205 acc->cfg.reg_retry_interval = cfg->reg_retry_interval; 1206 1206 acc->cfg.reg_first_retry_interval = cfg->reg_first_retry_interval; 1207 acc->cfg.reg_retry_random_interval = cfg->reg_retry_random_interval; 1207 1208 acc->cfg.drop_calls_on_reg_fail = cfg->drop_calls_on_reg_fail; 1208 1209 acc->cfg.register_on_acc_add = cfg->register_on_acc_add; … … 3540 3541 delay.msec = 0; 3541 3542 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 } 3548 3552 } 3549 3553 pj_time_val_normalize(&delay); -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r4945 r4957 289 289 cfg->srtp_optional_dup_offer = pjsua_var.ua_cfg.srtp_optional_dup_offer; 290 290 cfg->reg_retry_interval = PJSUA_REG_RETRY_INTERVAL; 291 cfg->reg_retry_random_interval = 10; 291 292 cfg->contact_rewrite_method = PJSUA_CONTACT_REWRITE_METHOD; 292 293 cfg->contact_use_src_port = PJ_TRUE; -
pjproject/trunk/pjsip/src/pjsua2/account.cpp
r4939 r4957 39 39 NODE_READ_UNSIGNED (this_node, retryIntervalSec); 40 40 NODE_READ_UNSIGNED (this_node, firstRetryIntervalSec); 41 NODE_READ_UNSIGNED (this_node, randomRetryIntervalSec); 41 42 NODE_READ_UNSIGNED (this_node, delayBeforeRefreshSec); 42 43 NODE_READ_BOOL (this_node, dropCallsOnFail); … … 56 57 NODE_WRITE_UNSIGNED (this_node, retryIntervalSec); 57 58 NODE_WRITE_UNSIGNED (this_node, firstRetryIntervalSec); 59 NODE_WRITE_UNSIGNED (this_node, randomRetryIntervalSec); 58 60 NODE_WRITE_UNSIGNED (this_node, delayBeforeRefreshSec); 59 61 NODE_WRITE_BOOL (this_node, dropCallsOnFail); … … 319 321 ret.reg_retry_interval = regConfig.retryIntervalSec; 320 322 ret.reg_first_retry_interval= regConfig.firstRetryIntervalSec; 323 ret.reg_retry_random_interval= regConfig.randomRetryIntervalSec; 321 324 ret.reg_delay_before_refresh= regConfig.delayBeforeRefreshSec; 322 325 ret.drop_calls_on_reg_fail = regConfig.dropCallsOnFail; … … 446 449 regConfig.retryIntervalSec = prm.reg_retry_interval; 447 450 regConfig.firstRetryIntervalSec = prm.reg_first_retry_interval; 451 regConfig.randomRetryIntervalSec = prm.reg_retry_random_interval; 448 452 regConfig.delayBeforeRefreshSec = prm.reg_delay_before_refresh; 449 453 regConfig.dropCallsOnFail = PJ2BOOL(prm.drop_calls_on_reg_fail);
Note: See TracChangeset
for help on using the changeset viewer.