update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7949 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
d86185c4ae
commit
e34e139f8b
|
@ -295,6 +295,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
|
|||
uint32_t current_ms = 0;
|
||||
uint32_t x, tick = 0;
|
||||
switch_time_t ts = 0, last = 0;
|
||||
int fwd_errs = 0, rev_errs = 0;
|
||||
|
||||
switch_time_sync();
|
||||
|
||||
|
@ -324,6 +325,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
|
|||
|
||||
ts = 0;
|
||||
last = 0;
|
||||
fwd_errs = rev_errs = 0;
|
||||
|
||||
while (globals.RUNNING == 1) {
|
||||
runtime.reference += STEP_MIC;
|
||||
|
@ -335,18 +337,31 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
|
|||
current_ms = 0;
|
||||
tick = 0;
|
||||
runtime.initiated += diff;
|
||||
rev_errs++;
|
||||
} else {
|
||||
rev_errs = 0;
|
||||
}
|
||||
switch_yield(STEP_MIC);
|
||||
last = ts;
|
||||
}
|
||||
|
||||
|
||||
if (ts > (runtime.reference + too_late)) {
|
||||
switch_time_t diff = ts - runtime.reference - STEP_MIC;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Forward Clock Skew Detected!\n");
|
||||
fwd_errs++;
|
||||
runtime.reference = switch_time_now();
|
||||
current_ms = 0;
|
||||
tick = 0;
|
||||
runtime.initiated += diff;
|
||||
} else {
|
||||
fwd_errs = 0;
|
||||
}
|
||||
|
||||
if (fwd_errs > 9 || rev_errs > 9) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Auto Re-Syncing clock.\n");
|
||||
switch_time_sync();
|
||||
fwd_errs = rev_errs = 0;
|
||||
}
|
||||
|
||||
runtime.timestamp = ts;
|
||||
|
|
Loading…
Reference in New Issue