Updates for mbtask
This commit is contained in:
parent
ddd8a8353b
commit
7dcb1dba1c
@ -84,9 +84,8 @@ int check_calllist(void)
|
|||||||
if (pots_calls || isdn_calls || inet_calls) {
|
if (pots_calls || isdn_calls || inet_calls) {
|
||||||
call_work = 0;
|
call_work = 0;
|
||||||
for (tmp = alist; tmp; tmp = tmp->next) {
|
for (tmp = alist; tmp; tmp = tmp->next) {
|
||||||
if (((tmp->callmode == CM_INET) && TCFG.max_tcp) ||
|
if (((tmp->callmode == CM_INET) && TCFG.max_tcp && internet) ||
|
||||||
((tmp->callmode == CM_ISDN) && TCFG.max_isdn) ||
|
((tmp->callmode == CM_ISDN) && TCFG.max_isdn) || ((tmp->callmode == CM_POTS) && TCFG.max_pots)) {
|
||||||
((tmp->callmode == CM_POTS) && TCFG.max_pots)) {
|
|
||||||
call_work++;
|
call_work++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -92,6 +92,7 @@ int tflags = FALSE; /* if nodes with Txx */
|
|||||||
extern int nxt_hour; /* Next event hour */
|
extern int nxt_hour; /* Next event hour */
|
||||||
extern int nxt_min; /* Next event minute */
|
extern int nxt_min; /* Next event minute */
|
||||||
extern _alist_l *alist; /* Nodes to call list */
|
extern _alist_l *alist; /* Nodes to call list */
|
||||||
|
int rescan = FALSE; /* Master rescan flag */
|
||||||
extern int pots_calls;
|
extern int pots_calls;
|
||||||
extern int isdn_calls;
|
extern int isdn_calls;
|
||||||
extern int inet_calls;
|
extern int inet_calls;
|
||||||
@ -563,7 +564,7 @@ int runtasktype(int tasktype)
|
|||||||
*/
|
*/
|
||||||
int checktasks(int onsig)
|
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++) {
|
for (i = 0; i < MAXTASKS; i++) {
|
||||||
if (strlen(task[i].name)) {
|
if (strlen(task[i].name)) {
|
||||||
@ -578,8 +579,11 @@ int checktasks(int onsig)
|
|||||||
task[i].rc = wait4(task[i].pid, &status, WNOHANG | WUNTRACED, NULL);
|
task[i].rc = wait4(task[i].pid, &status, WNOHANG | WUNTRACED, NULL);
|
||||||
if (task[i].rc) {
|
if (task[i].rc) {
|
||||||
task[i].running = FALSE;
|
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)
|
if (task[i].tasktype == CM_POTS || task[i].tasktype == CM_ISDN || task[i].tasktype == CM_INET)
|
||||||
do_outstat = TRUE;
|
rescan = TRUE;
|
||||||
ptimer = PAUSETIME;
|
ptimer = PAUSETIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -635,6 +639,7 @@ int checktasks(int onsig)
|
|||||||
if (calllist[j].taskpid == task[i].pid) {
|
if (calllist[j].taskpid == task[i].pid) {
|
||||||
calllist[j].calling = FALSE;
|
calllist[j].calling = FALSE;
|
||||||
calllist[j].taskpid = 0;
|
calllist[j].taskpid = 0;
|
||||||
|
rescan = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memset(&task[i], 0, sizeof(onetask));
|
memset(&task[i], 0, sizeof(onetask));
|
||||||
@ -642,11 +647,6 @@ int checktasks(int onsig)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_outstat) {
|
|
||||||
outstat();
|
|
||||||
check_calllist();
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -843,7 +843,7 @@ void scheduler(void)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
#endif
|
#endif
|
||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
int call_work;
|
int call_work = 0;
|
||||||
static int call_entry = MAXTASKS;
|
static int call_entry = MAXTASKS;
|
||||||
double loadavg[3];
|
double loadavg[3];
|
||||||
|
|
||||||
@ -1120,10 +1120,11 @@ void scheduler(void)
|
|||||||
/*
|
/*
|
||||||
* Update outbound status if needed.
|
* Update outbound status if needed.
|
||||||
*/
|
*/
|
||||||
if (s_scanout) {
|
if (rescan) {
|
||||||
|
rescan = FALSE;
|
||||||
outstat();
|
outstat();
|
||||||
|
call_work = check_calllist();
|
||||||
}
|
}
|
||||||
call_work = check_calllist();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Launch the systems to call, start one system each time.
|
* Launch the systems to call, start one system each time.
|
||||||
@ -1183,7 +1184,7 @@ void scheduler(void)
|
|||||||
if (calllist[call_entry].taskpid)
|
if (calllist[call_entry].taskpid)
|
||||||
calllist[call_entry].calling = TRUE;
|
calllist[call_entry].calling = TRUE;
|
||||||
running = checktasks(0);
|
running = checktasks(0);
|
||||||
check_calllist();
|
rescan = TRUE;
|
||||||
free(cmd);
|
free(cmd);
|
||||||
cmd = NULL;
|
cmd = NULL;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ int load_node(fidoaddr n)
|
|||||||
(n.node == nodes.Aka[i].node) && (n.point == nodes.Aka[i].point)) {
|
(n.node == nodes.Aka[i].node) && (n.point == nodes.Aka[i].point)) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
free(temp);
|
free(temp);
|
||||||
tasklog('-' , "Node record %d, aka nr %d", j, i+1);
|
// tasklog('-' , "Node record %d, aka nr %d", j, i+1);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,8 +227,8 @@ int outstat()
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc = load_node(tmp->addr);
|
rc = load_node(tmp->addr);
|
||||||
tasklog('o', "Load node %s rc=%s, NoCall=%s, NoTCP=%s", ascfnode(tmp->addr, 0x0f), rc?"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");
|
// nodes.NoCall?"True":"False", nodes.NoTCP?"True":"False");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Zone Mail Hours, only use Fidonet Hours.
|
* Zone Mail Hours, only use Fidonet Hours.
|
||||||
@ -303,7 +303,7 @@ int outstat()
|
|||||||
T_window = TRUE;
|
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,"...... ... ..");
|
strcpy(flstr,"...... ... ..");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -45,6 +45,7 @@ extern struct taskrec TCFG; /* Task config record */
|
|||||||
int ping_isocket; /* Ping socket */
|
int ping_isocket; /* Ping socket */
|
||||||
int icmp_errs = 0; /* ICMP error counter */
|
int icmp_errs = 0; /* ICMP error counter */
|
||||||
extern int internet; /* Internet is down */
|
extern int internet; /* Internet is down */
|
||||||
|
extern int rescan; /* Master rescan flag */
|
||||||
int pingstate = P_INIT; /* Ping state */
|
int pingstate = P_INIT; /* Ping state */
|
||||||
int pingnr = 1; /* Ping #, 1 or 2 */
|
int pingnr = 1; /* Ping #, 1 or 2 */
|
||||||
int pingresult[2]; /* Ping results */
|
int pingresult[2]; /* Ping results */
|
||||||
@ -331,6 +332,7 @@ void check_ping(void)
|
|||||||
internet = FALSE;
|
internet = FALSE;
|
||||||
sem_set((char *)"scanout", TRUE);
|
sem_set((char *)"scanout", TRUE);
|
||||||
RemoveSema((char *)"is_inet");
|
RemoveSema((char *)"is_inet");
|
||||||
|
rescan = TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!internet) {
|
if (!internet) {
|
||||||
@ -338,6 +340,7 @@ void check_ping(void)
|
|||||||
internet = TRUE;
|
internet = TRUE;
|
||||||
sem_set((char *)"scanout", TRUE);
|
sem_set((char *)"scanout", TRUE);
|
||||||
CreateSema((char *)"is_inet");
|
CreateSema((char *)"is_inet");
|
||||||
|
rescan = TRUE;
|
||||||
}
|
}
|
||||||
icmp_errs = 0;
|
icmp_errs = 0;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
|
|
||||||
extern char ttyfn[]; /* TTY file name */
|
extern char ttyfn[]; /* TTY file name */
|
||||||
extern time_t tty_time; /* TTY update time */
|
extern time_t tty_time; /* TTY update time */
|
||||||
|
extern int rescan; /* Master rescan flag */
|
||||||
pp_list *pl = NULL; /* Portlist */
|
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)
|
void check_ports(void)
|
||||||
{
|
{
|
||||||
@ -167,6 +169,10 @@ void check_ports(void)
|
|||||||
if (tpl->locked) {
|
if (tpl->locked) {
|
||||||
tpl->locked = 0;
|
tpl->locked = 0;
|
||||||
tasklog('+', "Port %s is now free", tpl->tty);
|
tasklog('+', "Port %s is now free", tpl->tty);
|
||||||
|
/*
|
||||||
|
* Good, set master rescan flag
|
||||||
|
*/
|
||||||
|
rescan = TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fscanf(lf, "%d", &tmppid);
|
fscanf(lf, "%d", &tmppid);
|
||||||
@ -175,10 +181,12 @@ void check_ports(void)
|
|||||||
if (kill(rempid, 0) && (errno == ESRCH)) {
|
if (kill(rempid, 0) && (errno == ESRCH)) {
|
||||||
tasklog('+', "Stale lockfile for %s, unlink", tpl->tty);
|
tasklog('+', "Stale lockfile for %s, unlink", tpl->tty);
|
||||||
unlink(lckname);
|
unlink(lckname);
|
||||||
|
rescan = TRUE;
|
||||||
} else {
|
} else {
|
||||||
if (!tpl->locked) {
|
if (!tpl->locked) {
|
||||||
tpl->locked = rempid;
|
tpl->locked = rempid;
|
||||||
tasklog('+', "Port %s locked, pid %d", tpl->tty, rempid);
|
tasklog('+', "Port %s locked, pid %d", tpl->tty, rempid);
|
||||||
|
rescan = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ int s_bbsopen = FALSE;
|
|||||||
int s_do_inet = FALSE;
|
int s_do_inet = FALSE;
|
||||||
extern int UPSalarm;
|
extern int UPSalarm;
|
||||||
extern int ptimer;
|
extern int ptimer;
|
||||||
|
extern int rescan;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -340,6 +341,8 @@ int sem_set(char *sem, int value)
|
|||||||
|
|
||||||
if (!strcmp(sem, "scanout")) {
|
if (!strcmp(sem, "scanout")) {
|
||||||
s_scanout = value;
|
s_scanout = value;
|
||||||
|
if (value)
|
||||||
|
rescan = TRUE;
|
||||||
} else if (!strcmp(sem, "mailout")) {
|
} else if (!strcmp(sem, "mailout")) {
|
||||||
s_mailout = value;
|
s_mailout = value;
|
||||||
} else if (!strcmp(sem, "mailin")) {
|
} else if (!strcmp(sem, "mailin")) {
|
||||||
|
Reference in New Issue
Block a user