--resolve FS-5432

This commit is contained in:
Ken Rice committed 2013-07-03 14:13:05 -05:00
1 parent fe27589af7
commit bf89fbd81d
5 files changed
+30

No files matched your search

@@ -3516,6 +3516,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
long exp_delta = 0;
char exp_delta_str[30] = "";
uint32_t sub_max_deviation_var = 0;
sip_to_t const *to;
const char *from_user = NULL, *from_host = NULL;
const char *to_user = NULL, *to_host = NULL;
@@ -3615,6 +3616,18 @@ void sofia_presence_handle_sip_i_subscribe(int status,
}
}
if ((sub_max_deviation_var = profile->sip_subscription_max_deviation)) {
if (sub_max_deviation_var > 0) {
int sub_deviation;
srand( (unsigned) ( (unsigned)(intptr_t)switch_thread_self() + switch_micro_time_now() ) );
/* random negative number between 0 and negative sub_max_deviation_var: */
sub_deviation = ( rand() % sub_max_deviation_var ) - sub_max_deviation_var;
if ( (exp_delta + sub_deviation) > 45 ) {
exp_delta += sub_deviation;
}
}
}
if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DELTA %ld\n", exp_delta);
}