Updates for mbtask

This commit is contained in:
Michiel Broek 2002-02-24 17:17:58 +00:00
parent 69d0ac0697
commit 2013b2bb89
10 changed files with 81 additions and 43 deletions

View File

@ -4644,6 +4644,8 @@ v0.33.20 10-Feb-2002
Lost of code cleanup.
No setup setting anymore for maximum POTS and ISDN lines, this
is now automatic.
mbtask will now update internal counters how many ISDN and POTS
lines are free to use for dialout.
mbcico:
Fixed binkp driver to accept incoming unprotected sessions.

View File

@ -39,7 +39,7 @@ H_IMAGES = images/b_arrow.gif images/magic.gif images/nodes1.gif \
images/hatch.gif images/nodelist4.gif images/tty3.gif \
images/language.gif images/nodelist5.gif images/uarrow.gif \
images/larrow.gif images/nodes.gif images/users.gif \
images/mbse.jpg images/taskmgr.gif images/mbsebbs.gif \
images/mbse.jpg images/taskmgr.png images/mbsebbs.gif \
images/mbsebbs.png images/users2.gif \
images/dream1.png images/dream2.png images/dream3.png \
images/tdream1.gif images/tdream2.gif images/tdream3.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

BIN
html/images/taskmgr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -12,7 +12,7 @@
</HEAD>
<BODY>
<BLOCKQUOTE>
<h5>Last update 29-Dec-2001</h5>
<h5>Last update 24-Feb-2002</h5>
<P>&nbsp;<P>
<H1>MBSE BBS Setup - Task Manager.</H1>
@ -41,14 +41,11 @@ The behaviour is setup in this screen.
<b>ISP disc </b>Not in use yet!
<b>Ping #1 </b>IP address of node to ping to check the internet.
<b>Ping #2 </b>IP address of second node to ping to check the internet.
<b>ISP blks </b>Set to true if you have internet dialup and it blocks normal dial.
<b>Max TCP </b>Maximum simultaneous outgoing calls over the internet.
<b>Max Load </b>Max system load until processing is suspended.
<b>ZMH start </b>Start of Zone Mail Hour in UTC time.
<b>ZMH end </b>End of Zone Mail Hour in UTC time.
<b>Debug </b>Enable debug logging.
<b>Max POTS </b>Maximum simultaneous outgoing calls over analogue modems.
<b>Max ISDN </b>Maximum simultaneous outgoing calls over ISDN channels.
<b>Max TCP </b>Maximum simultaneous outgoing calls over the internet.
</pre>
<P>
Default are the original MBSE commands filled in, but you could also call
@ -60,9 +57,12 @@ the nameservers of your own ISP here. One of these will always be up, so if one
of these can be reached, the internet connection is assumed to be alive. The
status of the internet connection is used to decide if it is allowed (and
possible) to call TCP/IP nodes. Calling these nodes is not depending on ZMH
unless the destination is not a CM node.
unless the destination is not a CM node.<br>
The <b>max load</b> setting decides at which system load point processing of background
tasks will be suspended. The default value should be allright for machines slower then 200
MHz or with low ram. On faster machines you may set this value higher.
<P>
<IMG SRC="../images/taskmgr.gif" Border="0">
<IMG SRC="../images/taskmgr.png" Border="0">
<P>
<A HREF="./"><IMG SRC="../images/larrow.gif" ALT="Back" Border="0"> Back to index</A>&nbsp;

View File

@ -121,16 +121,13 @@ int EditTask()
mvprintw(15, 1, "10. ISP disc");
mvprintw(16, 1, "11. Ping #1");
mvprintw(17, 1, "12. Ping #2");
mvprintw(18, 1, "13. ISP blks");
mvprintw(18, 1, "13. Max TCP");
mvprintw(19, 1, "14. Max Load");
mvprintw(18,29, "15. ZMH start");
mvprintw(19,29, "16. ZMH end");
mvprintw(16,55, "17. Debug");
mvprintw(17,55, "18. Max POTS");
mvprintw(18,55, "19. Max ISDN");
mvprintw(19,55, "20. Max TCP");
mvprintw(19,55, "17. Debug");
for (;;) {
set_color(WHITE, BLACK);
@ -146,19 +143,16 @@ int EditTask()
show_str(15, 15,65, TCFG.isp_hangup);
show_str(16, 15,40, TCFG.isp_ping1);
show_str(17, 15,40, TCFG.isp_ping2);
show_bool(18,15, TCFG.ipblocks);
show_int(18, 15, TCFG.max_tcp);
sprintf(temp, "%0.2f", TCFG.maxload);
show_str(19, 15,5, temp);
show_str( 18,44, 5, TCFG.zmh_start);
show_str( 19,44, 5, TCFG.zmh_end);
show_bool(16,69, TCFG.debug);
show_int( 17,69, TCFG.max_pots);
show_int( 18,69, TCFG.max_isdn);
show_int( 19,69, TCFG.max_tcp);
show_bool(19,69, TCFG.debug);
j = select_menu(20);
j = select_menu(17);
switch(j) {
case 0: return 0;
case 1: E_STR( 6,15,65,TCFG.cmd_mailout, "The command to execute on semafore ^mailout^")
@ -173,16 +167,13 @@ int EditTask()
case 10:E_STR( 15,15,65,TCFG.isp_hangup, "The command to ^hangup^ the Internet Connection")
case 11:E_STR( 16,15,40,TCFG.isp_ping1, "The ^IP address^ of host 1 to check the Internet Connection")
case 12:E_STR( 17,15,40,TCFG.isp_ping2, "The ^IP address^ of host 2 to check the Internet Connection")
case 13:E_BOOL(18,15, TCFG.ipblocks, "The ^internet^ connection ^blocks^ dial connections")
case 13:E_INT( 18,15, TCFG.max_tcp, "Maximum simultanous ^TCP/IP^ connections")
case 14:strcpy(temp, edit_str(19,15,5,temp, (char *)"^Maximum system load^ at which processing stops (1.00 .. 3.00)"));
sscanf(temp, "%f", &TCFG.maxload);
break;
case 15:E_STR( 18,44,5, TCFG.zmh_start, "^Start^ of Zone Mail Hour in UTC")
case 16:E_STR( 19,44,5, TCFG.zmh_end, "^End& of Zone Mail Hour in UTC")
case 17:E_BOOL(16,69, TCFG.debug, "Enable ^debug^ logging")
case 18:E_INT( 17,69, TCFG.max_pots, "Maximum simultanous ^POTS^ (analogue) connections")
case 19:E_INT( 18,69, TCFG.max_isdn, "Maximum simultanous ^ISDN^ connections")
case 20:E_INT( 19,69, TCFG.max_tcp, "Maximum simultanous ^TCP/IP^ connections")
case 17:E_BOOL(19,69, TCFG.debug, "Enable ^debug^ logging")
}
}
@ -230,12 +221,9 @@ int task_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " ISP hangup command %s\n", TCFG.isp_hangup);
fprintf(fp, " ISP ping host 1 %s\n", TCFG.isp_ping1);
fprintf(fp, " ISP ping host 2 %s\n", TCFG.isp_ping2);
fprintf(fp, " Internet blocks dial %s\n\n", getboolean(TCFG.ipblocks));
fprintf(fp, " Enable denug logging %s\n", getboolean(TCFG.debug));
fprintf(fp, " Maximum system load %0.2f\n", TCFG.maxload);
fprintf(fp, " Max POTS connections %d\n", TCFG.max_pots);
fprintf(fp, " Max ISDN connections %d\n", TCFG.max_isdn);
fprintf(fp, " Max TCP/IP connections %d\n", TCFG.max_tcp);
return page;

View File

@ -49,6 +49,8 @@ extern _alist_l *alist; /* Nodes to call list */
extern int pots_calls;
extern int isdn_calls;
extern int inet_calls;
extern int pots_lines; /* POTS lines available */
extern int isdn_lines; /* ISDN lines available */
extern struct taskrec TCFG;
@ -85,7 +87,7 @@ int check_calllist(void)
call_work = 0;
for (tmp = alist; tmp; tmp = tmp->next) {
if (((tmp->callmode == CM_INET) && TCFG.max_tcp && internet) ||
((tmp->callmode == CM_ISDN) && TCFG.max_isdn) || ((tmp->callmode == CM_POTS) && TCFG.max_pots)) {
((tmp->callmode == CM_ISDN) && isdn_lines) || ((tmp->callmode == CM_POTS) && pots_lines)) {
call_work++;
/*

View File

@ -96,6 +96,10 @@ int rescan = FALSE; /* Master rescan flag */
extern int pots_calls;
extern int isdn_calls;
extern int inet_calls;
extern int pots_lines; /* POTS lines available */
extern int isdn_lines; /* ISDN lines available */
extern int pots_free; /* POTS lines free */
extern int isdn_free; /* ISDN lines free */
@ -423,10 +427,7 @@ void load_taskcfg(void)
sprintf(TCFG.cmd_mbindex2, "%s/bin/goldnode -f -q", getenv("MBSE_ROOT"));
sprintf(TCFG.cmd_msglink, "%s/bin/mbmsg link -quiet", getenv("MBSE_ROOT"));
sprintf(TCFG.cmd_reqindex, "%s/bin/mbfile index -quiet", getenv("MBSE_ROOT"));
TCFG.ipblocks = TRUE;
TCFG.debug = FALSE;
TCFG.max_pots = 1;
TCFG.max_isdn = 0;
TCFG.max_tcp = 0;
sprintf(TCFG.isp_ping1, "192.168.1.1");
sprintf(TCFG.isp_ping2, "192.168.1.1");
@ -902,6 +903,9 @@ void scheduler(void)
initnl();
sem_set((char *)"scanout", TRUE);
if (!TCFG.max_tcp && !pots_lines && !isdn_lines) {
tasklog('?', "ERROR: this system cannot connect to other systems, check setup");
}
/*
* Enter the mainloop (forever)
@ -1157,11 +1161,11 @@ void scheduler(void)
found = TRUE;
break;
}
if ((calllist[call_entry].callmode == CM_ISDN) && (runtasktype(CM_ISDN) < TCFG.max_isdn)) {
if ((calllist[call_entry].callmode == CM_ISDN) && (runtasktype(CM_ISDN) < isdn_free)) {
found = TRUE;
break;
}
if ((calllist[call_entry].callmode == CM_POTS) && (runtasktype(CM_POTS) < TCFG.max_pots)) {
if ((calllist[call_entry].callmode == CM_POTS) && (runtasktype(CM_POTS) < pots_free)) {
found = TRUE;
break;
}
@ -1176,6 +1180,11 @@ void scheduler(void)
}
if (found) {
// tasklog('c', "Should launch slot %d node %s", call_entry, ascfnode(calllist[call_entry].addr, 0x1f));
/*
* FIXME: here we should check if there are multiple ISDN or POTS lines which of the
* lines matches the flags to call that node and use the most simple device.
* The mbcico should be called with the instruction which line to use.
*/
cmd = xstrcpy(pw->pw_dir);
cmd = xstrcat(cmd, (char *)"/bin/mbcico");
sprintf(opts, "f%u.n%u.z%u", calllist[call_entry].addr.node, calllist[call_entry].addr.net,

View File

@ -48,6 +48,8 @@ int isdn_calls; /* ISDN calls to make */
int pots_calls; /* POTS calls to make */
_alist_l *alist = NULL; /* Nodes to call list */
extern int s_do_inet; /* Internet wanted */
extern int pots_lines; /* POTS lines available */
extern int isdn_lines; /* ISDN lines available */
@ -389,7 +391,7 @@ int outstat()
tmp->callmode = CM_INET;
}
if ((tmp->callmode == CM_NONE) && TCFG.max_isdn) {
if ((tmp->callmode == CM_NONE) && isdn_lines) {
/*
* ISDN node
*/
@ -398,7 +400,7 @@ int outstat()
break;
}
if ((tmp->callmode == CM_NONE) && TCFG.max_pots) {
if ((tmp->callmode == CM_NONE) && pots_lines) {
/*
* POTS node
*/
@ -406,6 +408,13 @@ int outstat()
tmp->callmode = CM_POTS;
break;
}
/*
* Here we are out of options.
*/
if (tmp->callmode == CM_NONE) {
tasklog('!', "No method to call %s available", ascfnode(tmp->addr, 0x0f));
}
}
/*

View File

@ -52,6 +52,11 @@ extern time_t tty_time; /* TTY update time */
extern int rescan; /* Master rescan flag */
pp_list *pl = NULL; /* Portlist */
int pots_lines = 0; /* POTS (Modem) lines */
int isdn_lines = 0; /* ISDN lines */
int pots_free = 0; /* POTS (Modem) lines free */
int isdn_free = 0; /* ISDN lines free */
/*
@ -106,7 +111,7 @@ void load_ports()
{
FILE *fp;
pp_list new;
int count = 0, j, stdflag;
int j, stdflag;
char *p, *q;
tidy_portlist(&pl);
@ -117,8 +122,16 @@ 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) {
if (((ttyinfo.type == POTS) || (ttyinfo.type == ISDN)) && (ttyinfo.available) && (ttyinfo.callout)) {
if (ttyinfo.type == POTS)
pots_lines++;
if (ttyinfo.type == ISDN)
isdn_lines++;
memset(&new, 0, sizeof(new));
strncpy(new.tty, ttyinfo.tty, 6);
@ -138,14 +151,15 @@ void load_ports()
new.dflags |= dkey[j].flag;
}
}
tasklog('p', "port %s modem %08lx ISDN %08lx", new.tty, new.mflags, new.dflags);
fill_portlist(&pl, &new);
count++;
}
}
fclose(fp);
tty_time = file_time(ttyfn);
tasklog('p', "make_portlist %d ports", count);
tasklog('+', "Detected %d modem ports and %d ISDN ports", pots_lines, isdn_lines);
}
@ -159,12 +173,13 @@ void check_ports(void)
pp_list *tpl;
char lckname[256];
FILE *lf;
int tmppid;
int tmppid, changed = FALSE;
pid_t rempid = 0;
pots_free = isdn_free = 0;
for (tpl = pl; tpl; tpl = tpl->next) {
sprintf(lckname, "%s%s", LCKPREFIX, tpl->tty);
// tasklog('p', "checking %s", lckname);
if ((lf = fopen(lckname, "r")) == NULL) {
if (tpl->locked) {
tpl->locked = 0;
@ -172,7 +187,7 @@ void check_ports(void)
/*
* Good, set master rescan flag
*/
rescan = TRUE;
changed = TRUE;
}
} else {
fscanf(lf, "%d", &tmppid);
@ -181,15 +196,28 @@ void check_ports(void)
if (kill(rempid, 0) && (errno == ESRCH)) {
tasklog('+', "Stale lockfile for %s, unlink", tpl->tty);
unlink(lckname);
rescan = TRUE;
changed = TRUE;
} else {
if (!tpl->locked) {
tpl->locked = rempid;
tasklog('+', "Port %s locked, pid %d", tpl->tty, rempid);
rescan = TRUE;
changed = TRUE;
}
}
}
/*
* Now count free ports
*/
if (tpl->mflags && !tpl->locked)
pots_free++;
if (tpl->dflags && !tpl->locked)
isdn_free++;
if (changed) {
rescan = TRUE;
tasklog('p', "Free ports: pots=%d isdn=%d", pots_free, isdn_free);
}
}
}