Updates for mbtask

This commit is contained in:
Michiel Broek 2002-02-24 13:52:13 +00:00
parent ddd8a8353b
commit 7dcb1dba1c
6 changed files with 33 additions and 19 deletions

View File

@ -84,9 +84,8 @@ int check_calllist(void)
if (pots_calls || isdn_calls || inet_calls) {
call_work = 0;
for (tmp = alist; tmp; tmp = tmp->next) {
if (((tmp->callmode == CM_INET) && TCFG.max_tcp) ||
((tmp->callmode == CM_ISDN) && TCFG.max_isdn) ||
((tmp->callmode == CM_POTS) && TCFG.max_pots)) {
if (((tmp->callmode == CM_INET) && TCFG.max_tcp && internet) ||
((tmp->callmode == CM_ISDN) && TCFG.max_isdn) || ((tmp->callmode == CM_POTS) && TCFG.max_pots)) {
call_work++;
/*

View File

@ -92,6 +92,7 @@ int tflags = FALSE; /* if nodes with Txx */
extern int nxt_hour; /* Next event hour */
extern int nxt_min; /* Next event minute */
extern _alist_l *alist; /* Nodes to call list */
int rescan = FALSE; /* Master rescan flag */
extern int pots_calls;
extern int isdn_calls;
extern int inet_calls;
@ -563,7 +564,7 @@ int runtasktype(int tasktype)
*/
int checktasks(int onsig)
{
int i, j, rc, count = 0, first = TRUE, status, do_outstat = FALSE;
int i, j, rc, count = 0, first = TRUE, status;
for (i = 0; i < MAXTASKS; i++) {
if (strlen(task[i].name)) {
@ -578,8 +579,11 @@ int checktasks(int onsig)
task[i].rc = wait4(task[i].pid, &status, WNOHANG | WUNTRACED, NULL);
if (task[i].rc) {
task[i].running = FALSE;
/*
* If a mailer call is finished, set the global rescan flag.
*/
if (task[i].tasktype == CM_POTS || task[i].tasktype == CM_ISDN || task[i].tasktype == CM_INET)
do_outstat = TRUE;
rescan = TRUE;
ptimer = PAUSETIME;
}
@ -635,6 +639,7 @@ int checktasks(int onsig)
if (calllist[j].taskpid == task[i].pid) {
calllist[j].calling = FALSE;
calllist[j].taskpid = 0;
rescan = TRUE;
}
}
memset(&task[i], 0, sizeof(onetask));
@ -642,11 +647,6 @@ int checktasks(int onsig)
}
}
if (do_outstat) {
outstat();
check_calllist();
}
return count;
}
@ -843,7 +843,7 @@ void scheduler(void)
FILE *fp;
#endif
struct pollfd pfd;
int call_work;
int call_work = 0;
static int call_entry = MAXTASKS;
double loadavg[3];
@ -1120,10 +1120,11 @@ void scheduler(void)
/*
* Update outbound status if needed.
*/
if (s_scanout) {
if (rescan) {
rescan = FALSE;
outstat();
call_work = check_calllist();
}
call_work = check_calllist();
/*
* Launch the systems to call, start one system each time.
@ -1183,7 +1184,7 @@ void scheduler(void)
if (calllist[call_entry].taskpid)
calllist[call_entry].calling = TRUE;
running = checktasks(0);
check_calllist();
rescan = TRUE;
free(cmd);
cmd = NULL;
}

View File

@ -78,7 +78,7 @@ int load_node(fidoaddr n)
(n.node == nodes.Aka[i].node) && (n.point == nodes.Aka[i].point)) {
fclose(fp);
free(temp);
tasklog('-' , "Node record %d, aka nr %d", j, i+1);
// tasklog('-' , "Node record %d, aka nr %d", j, i+1);
return TRUE;
}
}
@ -227,8 +227,8 @@ int outstat()
}
rc = load_node(tmp->addr);
tasklog('o', "Load node %s rc=%s, NoCall=%s, NoTCP=%s", ascfnode(tmp->addr, 0x0f), rc?"true":"false",
nodes.NoCall?"True":"False", nodes.NoTCP?"True":"False");
// tasklog('o', "Load node %s rc=%s, NoCall=%s, NoTCP=%s", ascfnode(tmp->addr, 0x0f), rc?"true":"false",
// nodes.NoCall?"True":"False", nodes.NoTCP?"True":"False");
/*
* Zone Mail Hours, only use Fidonet Hours.
@ -303,7 +303,7 @@ int outstat()
T_window = TRUE;
}
}
tasklog('o', "T_window=%s, iszmh=%s", T_window?"true":"false", iszmh?"true":"false");
// tasklog('o', "T_window=%s, iszmh=%s", T_window?"true":"false", iszmh?"true":"false");
strcpy(flstr,"...... ... ..");
/*

View File

@ -45,6 +45,7 @@ extern struct taskrec TCFG; /* Task config record */
int ping_isocket; /* Ping socket */
int icmp_errs = 0; /* ICMP error counter */
extern int internet; /* Internet is down */
extern int rescan; /* Master rescan flag */
int pingstate = P_INIT; /* Ping state */
int pingnr = 1; /* Ping #, 1 or 2 */
int pingresult[2]; /* Ping results */
@ -331,6 +332,7 @@ void check_ping(void)
internet = FALSE;
sem_set((char *)"scanout", TRUE);
RemoveSema((char *)"is_inet");
rescan = TRUE;
}
} else {
if (!internet) {
@ -338,6 +340,7 @@ void check_ping(void)
internet = TRUE;
sem_set((char *)"scanout", TRUE);
CreateSema((char *)"is_inet");
rescan = TRUE;
}
icmp_errs = 0;
}

View File

@ -49,6 +49,7 @@
extern char ttyfn[]; /* TTY file name */
extern time_t tty_time; /* TTY update time */
extern int rescan; /* Master rescan flag */
pp_list *pl = NULL; /* Portlist */
@ -150,7 +151,8 @@ void load_ports()
/*
* Check status of all modem/ISDN ports
* Check status of all modem/ISDN ports.
* If something is changed set the master rescan flag.
*/
void check_ports(void)
{
@ -167,6 +169,10 @@ void check_ports(void)
if (tpl->locked) {
tpl->locked = 0;
tasklog('+', "Port %s is now free", tpl->tty);
/*
* Good, set master rescan flag
*/
rescan = TRUE;
}
} else {
fscanf(lf, "%d", &tmppid);
@ -175,10 +181,12 @@ void check_ports(void)
if (kill(rempid, 0) && (errno == ESRCH)) {
tasklog('+', "Stale lockfile for %s, unlink", tpl->tty);
unlink(lckname);
rescan = TRUE;
} else {
if (!tpl->locked) {
tpl->locked = rempid;
tasklog('+', "Port %s locked, pid %d", tpl->tty, rempid);
rescan = TRUE;
}
}
}

View File

@ -51,6 +51,7 @@ int s_bbsopen = FALSE;
int s_do_inet = FALSE;
extern int UPSalarm;
extern int ptimer;
extern int rescan;
@ -340,6 +341,8 @@ int sem_set(char *sem, int value)
if (!strcmp(sem, "scanout")) {
s_scanout = value;
if (value)
rescan = TRUE;
} else if (!strcmp(sem, "mailout")) {
s_mailout = value;
} else if (!strcmp(sem, "mailin")) {