Changed ping test scheduling

This commit is contained in:
Michiel Broek
2002-06-05 19:30:31 +00:00
parent f781ff6b71
commit 43de18522a
5 changed files with 35 additions and 24 deletions

View File

@@ -1031,8 +1031,23 @@ void scheduler(void)
}
}
/*
* Check system processing state
*/
if (s_bbsopen && !UPSalarm && !LOADhi) {
if (!Processing) {
tasklog('+', "Resuming normal operations");
Processing = TRUE;
}
} else {
if (Processing) {
tasklog('+', "Suspending operations");
Processing = FALSE;
}
}
if (Processing) {
/*
* Check Pause Timer, make sure it's only checked
* once each second.
@@ -1043,11 +1058,6 @@ void scheduler(void)
ptimer--;
}
if (!Processing) {
tasklog('+', "Resuming normal operations");
Processing = TRUE;
}
/*
* Here we run all normal operations.
*/
@@ -1107,14 +1117,17 @@ void scheduler(void)
s_reqindex = FALSE;
}
if ((tm->tm_sec / SLOWRUN) != oldmin) {
} /* if (Processing) */
/*
* These tasks run once per 20 seconds.
*/
oldmin = tm->tm_sec / SLOWRUN;
if ((tm->tm_sec / SLOWRUN) != oldmin) {
check_ping();
/*
* These tasks run once per 20 seconds.
*/
oldmin = tm->tm_sec / SLOWRUN;
check_ping();
if (Processing) {
/*
* Update outbound status if needed.
@@ -1206,19 +1219,15 @@ void scheduler(void)
cmd = NULL;
}
}
}
} /* if (Processing) */
/*
* PING state changes
*/
state_ping();
} else {
if (Processing) {
tasklog('+', "Suspending operations");
Processing = FALSE;
}
}
} /* if ((tm->tm_sec / SLOWRUN) != oldmin) */
} while (TRUE);
}

View File

@@ -401,7 +401,7 @@ void state_ping(void)
/*
* Create the ping socket, called from main() durig init as root.
* Create the ping socket, called from main() during init as root.
*/
void init_pingsocket(void)
{

View File

@@ -67,7 +67,6 @@ void tidy_portlist(pp_list ** fdp)
{
pp_list *tmp, *old;
tasklog('p', "tidy_portlist");
for (tmp = *fdp; tmp; tmp = old) {
old = tmp->next;
free(tmp);
@@ -121,7 +120,6 @@ void load_ports()
}
fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, fp);
tasklog('p', "Building portlist...");
pots_lines = isdn_lines = 0;
while (fread(&ttyinfo, ttyinfohdr.recsize, 1, fp) == 1) {
@@ -159,7 +157,8 @@ void load_ports()
fclose(fp);
tty_time = file_time(ttyfn);
tasklog('+', "Detected %d modem ports and %d ISDN ports", pots_lines, isdn_lines);
tasklog('+', "Detected %d modem port%s and %d ISDN port%s",
pots_lines, (pots_lines == 1)?"":"s", isdn_lines, (isdn_lines == 1)?"":"s");
}