forked from Mirrors/freeswitch
MODAPP-387
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16278 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
8912b80e13
commit
e5cadc5196
|
@ -93,7 +93,7 @@ static switch_cache_db_handle_t *cidlookup_get_db_handle(void)
|
|||
switch_cache_db_connection_options_t options = { {0} };
|
||||
switch_cache_db_handle_t *dbh = NULL;
|
||||
|
||||
if (globals.odbc_dsn && globals.odbc_user && globals.odbc_pass) {
|
||||
if (!zstr(globals.odbc_dsn)) {
|
||||
options.odbc_options.dsn = globals.odbc_dsn;
|
||||
options.odbc_options.user = globals.odbc_user;
|
||||
options.odbc_options.pass = globals.odbc_pass;
|
||||
|
|
|
@ -289,7 +289,7 @@ switch_cache_db_handle_t *fifo_get_db_handle(void)
|
|||
switch_cache_db_connection_options_t options = { {0} };
|
||||
switch_cache_db_handle_t *dbh = NULL;
|
||||
|
||||
if (globals.odbc_dsn && globals.odbc_user && globals.odbc_pass) {
|
||||
if (!zstr(globals.odbc_dsn)) {
|
||||
options.odbc_options.dsn = globals.odbc_dsn;
|
||||
options.odbc_options.user = globals.odbc_user;
|
||||
options.odbc_options.pass = globals.odbc_pass;
|
||||
|
@ -1873,8 +1873,6 @@ static switch_status_t load_config(int reload, int del_all)
|
|||
{
|
||||
char *cf = "fifo.conf";
|
||||
switch_xml_t cfg, xml, fifo, fifos, member, settings, param;
|
||||
char *odbc_user = NULL;
|
||||
char *odbc_pass = NULL;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
char *sql;
|
||||
switch_bool_t delete_all_outbound_member_on_startup = SWITCH_FALSE;
|
||||
|
@ -1913,7 +1911,7 @@ static switch_status_t load_config(int reload, int del_all)
|
|||
}
|
||||
}
|
||||
|
||||
if (zstr(globals.odbc_dsn) || zstr(odbc_user) || zstr(odbc_pass)) {
|
||||
if (zstr(globals.odbc_dsn)) {
|
||||
globals.dbname = "fifo";
|
||||
}
|
||||
|
||||
|
|
|
@ -394,7 +394,7 @@ static switch_cache_db_handle_t *lcr_get_db_handle(void)
|
|||
switch_cache_db_connection_options_t options = { {0} };
|
||||
switch_cache_db_handle_t *dbh = NULL;
|
||||
|
||||
if (globals.odbc_dsn && globals.odbc_user && globals.odbc_pass) {
|
||||
if (!zstr(globals.odbc_dsn)) {
|
||||
options.odbc_options.dsn = globals.odbc_dsn;
|
||||
options.odbc_options.user = globals.odbc_user;
|
||||
options.odbc_options.pass = globals.odbc_pass;
|
||||
|
|
|
@ -95,7 +95,7 @@ switch_cache_db_handle_t *limit_get_db_handle(void)
|
|||
switch_cache_db_connection_options_t options = { {0} };
|
||||
switch_cache_db_handle_t *dbh = NULL;
|
||||
|
||||
if (globals.odbc_dsn && globals.odbc_user && globals.odbc_pass) {
|
||||
if (!zstr(globals.odbc_dsn)) {
|
||||
options.odbc_options.dsn = globals.odbc_dsn;
|
||||
options.odbc_options.user = globals.odbc_user;
|
||||
options.odbc_options.pass = globals.odbc_pass;
|
||||
|
@ -205,7 +205,7 @@ static switch_status_t do_config()
|
|||
}
|
||||
|
||||
|
||||
if (zstr(globals.odbc_dsn) || zstr(globals.odbc_user) || zstr(globals.odbc_pass)) {
|
||||
if (zstr(globals.odbc_dsn)) {
|
||||
globals.dbname = "call_limit";
|
||||
dbh = limit_get_db_handle();
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ switch_cache_db_handle_t *vm_get_db_handle(vm_profile_t *profile)
|
|||
switch_cache_db_connection_options_t options = { {0} };
|
||||
switch_cache_db_handle_t *dbh = NULL;
|
||||
|
||||
if (profile->odbc_dsn && profile->odbc_user && profile->odbc_pass) {
|
||||
if (!zstr(profile->odbc_dsn)) {
|
||||
options.odbc_options.dsn = profile->odbc_dsn;
|
||||
options.odbc_options.user = profile->odbc_user;
|
||||
options.odbc_options.pass = profile->odbc_pass;
|
||||
|
|
|
@ -4208,7 +4208,7 @@ switch_cache_db_handle_t *sofia_glue_get_db_handle(sofia_profile_t *profile)
|
|||
switch_cache_db_connection_options_t options = { {0} };
|
||||
switch_cache_db_handle_t *dbh = NULL;
|
||||
|
||||
if (profile->odbc_dsn && profile->odbc_user && profile->odbc_pass) {
|
||||
if (!zstr(profile->odbc_dsn)) {
|
||||
options.odbc_options.dsn = profile->odbc_dsn;
|
||||
options.odbc_options.user = profile->odbc_user;
|
||||
options.odbc_options.pass = profile->odbc_pass;
|
||||
|
|
|
@ -58,7 +58,7 @@ SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t
|
|||
switch_cache_db_connection_options_t options = { {0} };
|
||||
switch_status_t r;
|
||||
|
||||
if (runtime.odbc_dsn && runtime.odbc_user && runtime.odbc_pass) {
|
||||
if (!zstr(runtime.odbc_dsn)) {
|
||||
options.odbc_options.dsn = runtime.odbc_dsn;
|
||||
options.odbc_options.user = runtime.odbc_user;
|
||||
options.odbc_options.pass = runtime.odbc_pass;
|
||||
|
|
|
@ -176,29 +176,39 @@ static switch_interval_time_t average_time(switch_interval_time_t t, int reps)
|
|||
|
||||
}
|
||||
|
||||
#define calc_step() if ((step - 10) > 10) step -= 10; else if (step > 1) step--
|
||||
static void calibrate_clock(void)
|
||||
{
|
||||
int x;
|
||||
switch_interval_time_t avg, val = 1000, want = 1000;
|
||||
int over = 0, under = 0, good = 0;
|
||||
int over = 0, under = 0, good = 0, step = 50;
|
||||
|
||||
for (x = 0; x < 500; x++) {
|
||||
avg = average_time(val, 100);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Test: %ld Average: %ld Step: %d\n", val, avg, step);
|
||||
|
||||
if (abs((int)(want - avg)) <= 2) {
|
||||
under = over = 0;
|
||||
if (++good > 10) {
|
||||
break;
|
||||
}
|
||||
} else if (avg > want) {
|
||||
val--;
|
||||
over++;
|
||||
under = 0;
|
||||
val -= step;
|
||||
if (++over > 3) {
|
||||
calc_step();
|
||||
}
|
||||
} else if (avg < want) {
|
||||
val++;
|
||||
under++;
|
||||
over = 0;
|
||||
val += step;
|
||||
if (++under > 3) {
|
||||
calc_step();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OFFSET = (int)(want - val);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer offset of %d calculated\n", OFFSET);
|
||||
}
|
||||
|
||||
|
||||
|
@ -289,7 +299,7 @@ SWITCH_DECLARE(void) switch_micro_sleep(switch_interval_time_t t)
|
|||
SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t)
|
||||
{
|
||||
|
||||
if (!globals.RUNNING || t < 1000 || t >= 10000) {
|
||||
if (globals.RUNNING != 1 || t < 1000 || t >= 10000) {
|
||||
do_sleep(t);
|
||||
return;
|
||||
}
|
||||
|
@ -580,7 +590,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
|
|||
}
|
||||
#endif
|
||||
|
||||
calibrate_clock();
|
||||
|
||||
switch_time_sync();
|
||||
|
||||
globals.use_cond_yield = COND;
|
||||
|
@ -917,6 +927,9 @@ SWITCH_MODULE_LOAD_FUNCTION(softtimer_load)
|
|||
timer_interface->timer_check = timer_check;
|
||||
timer_interface->timer_destroy = timer_destroy;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Calibrating timer, please wait...\n");
|
||||
calibrate_clock();
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ alias mcommit='svn commit --no-auth-cache --username=mikej'
|
|||
alias bcommit='svn commit --no-auth-cache --username=brian'
|
||||
alias icommit='svn commit --no-auth-cache --username=intralanman'
|
||||
alias dp='emacs /usr/local/freeswitch/conf/dialplan/default.xml'
|
||||
alias fstop='top -p `cat /usr/local/freeswitch/log/freeswitch.pid`'
|
||||
alias fsgdb='gdb /usr/local/freeswitch/bin/freeswitch `cat /usr/local/freeswitch/log/freeswitch.pid`'
|
||||
alias fstop='top -p `cat /usr/local/freeswitch/run/freeswitch.pid`'
|
||||
alias fsgdb='gdb /usr/local/freeswitch/bin/freeswitch `cat /usr/local/freeswitch/run/freeswitch.pid`'
|
||||
alias fscore='gdb /usr/local/freeswitch/bin/freeswitch `ls -rt core.* | tail -n1`'
|
||||
alias emacs='emacs -nw'
|
||||
# End of file
|
||||
|
|
Loading…
Reference in New Issue