Updates for outbound scanning

This commit is contained in:
Michiel Broek 2002-02-24 12:56:14 +00:00
parent 14ad175e93
commit ddd8a8353b
4 changed files with 265 additions and 266 deletions

View File

@ -84,7 +84,7 @@ taskcomm.o: libs.h ../lib/structs.h taskstat.h taskregs.h taskdisk.h taskinfo.h
taskinfo.o: libs.h ../lib/structs.h taskinfo.h
taskstat.o: libs.h ../lib/structs.h taskstat.h callstat.h outstat.h taskutil.h
mbtask.o: libs.h ../lib/structs.h signame.h taskstat.h taskutil.h taskregs.h taskcomm.h callstat.h outstat.h nodelist.h ports.h calllist.h ping.h mbtask.h
outstat.o: libs.h ../lib/structs.h taskutil.h taskstat.h scanout.h nodelist.h callstat.h ports.h outstat.h
outstat.o: libs.h ../lib/structs.h taskutil.h taskstat.h scanout.h nodelist.h callstat.h outstat.h
signame.o: signame.h
taskdisk.o: libs.h ../lib/structs.h taskdisk.h taskutil.h
taskregs.o: libs.h ../lib/structs.h taskstat.h taskregs.h taskutil.h

View File

@ -35,7 +35,6 @@
#include "callstat.h"
#include "outstat.h"
#include "mbtask.h"
#include "ports.h"
#include "calllist.h"
@ -46,12 +45,11 @@
tocall calllist[MAXTASKS]; /* Array with calllist */
extern int internet; /* Internet is down */
extern int s_scanout; /* Scan outbound sema */
extern int s_do_inet; /* Internet wanted */
extern _alist_l *alist; /* Nodes to call list */
extern int pots_calls;
extern int isdn_calls;
extern int inet_calls;
extern struct taskrec TCFG;
@ -83,13 +81,17 @@ int check_calllist(void)
}
}
check_ports();
if (pots_calls || isdn_calls || inet_calls) {
call_work = 0;
for (tmp = alist; tmp; tmp = tmp->next) {
if (tmp->callmode != CM_NONE) {
if (((tmp->callmode == CM_INET) && TCFG.max_tcp) ||
((tmp->callmode == CM_ISDN) && TCFG.max_isdn) ||
((tmp->callmode == CM_POTS) && TCFG.max_pots)) {
call_work++;
/*
* Check if node is already in the list of systems to call.
*/
found = FALSE;
for (i = 0; i < MAXTASKS; i++) {
if ((calllist[i].addr.zone == tmp->addr.zone) && (calllist[i].addr.net == tmp->addr.net) &&
@ -101,6 +103,10 @@ int check_calllist(void)
calllist[i].cst = tmp->cst;
}
}
/*
* Node not in the calllist, add node.
*/
if (!found) {
for (i = 0; i < MAXTASKS; i++) {
if (!calllist[i].addr.zone) {
@ -123,17 +129,6 @@ int check_calllist(void)
sem_set((char *)"scanout", FALSE);
}
/*
* Check if we need to remove the do_inet semafore
*/
if (!inet_calls && internet && s_do_inet) {
tasklog('c', "Removing do_inet semafore");
s_do_inet = FALSE;
if (IsSema((char *)"do_inet")) {
RemoveSema((char *)"do_inet");
}
}
call_work = 0;
for (i = 0; i < MAXTASKS; i++) {
if (calllist[i].addr.zone) {

View File

@ -85,7 +85,6 @@ extern int s_index; /* Compile nl semafore */
extern int s_newnews; /* New news semafore */
extern int s_reqindex; /* Create req index sem */
extern int s_msglink; /* Messages link sem */
extern int s_do_inet; /* Internet wanted */
extern int pingresult[2]; /* Ping results */
int masterinit = FALSE; /* Master init needed */
int ptimer = PAUSETIME; /* Pause timer */
@ -943,6 +942,7 @@ void scheduler(void)
*/
reg_check();
check_sema();
check_ports();
/*
* Check the systems load average.

View File

@ -35,7 +35,6 @@
#include "scanout.h"
#include "nodelist.h"
#include "callstat.h"
#include "ports.h"
#include "outstat.h"
@ -47,7 +46,6 @@ int nxt_hour, nxt_min; /* Time of next event */
int inet_calls; /* Internet calls to make */
int isdn_calls; /* ISDN calls to make */
int pots_calls; /* POTS calls to make */
extern pp_list *pl; /* Portlist */
_alist_l *alist = NULL; /* Nodes to call list */
extern int s_do_inet; /* Internet wanted */
@ -172,6 +170,16 @@ char *callmode(int mode)
/*
* Scan outbound, the call status is set in three counters: internet,
* ISDN and POTS (analogue modems).
* For all systems the CM and Txx flags are checked and for official
* FidoNet nodes the Zone Mail Hour wich belongs to the destination
* zone.
* All nodes are qualified, if there is a way to call them or not on
* this moment.
* The method how to call a node is decided as well.
*/
int outstat()
{
int rc, first = TRUE, T_window, iszmh = FALSE;
@ -182,7 +190,6 @@ int outstat()
time_t now;
struct tm *tm;
int uhour, umin, thour, tmin;
pp_list *tpl;
now = time(NULL);
tm = gmtime(&now); /* UTC time */
@ -298,19 +305,17 @@ int outstat()
}
tasklog('o', "T_window=%s, iszmh=%s", T_window?"true":"false", iszmh?"true":"false");
strcpy(flstr,"...... ... ..");
/*
* If the node has internet and we have internet available, check if we can send
* immediatly.
* If the node has internet and we have internet configured,
* check if we can send immediatly.
*/
if (TCFG.max_tcp &&
if (TCFG.max_tcp && (tmp->olflags & OL_CM) &&
(((tmp->flavors) & F_IMM) || ((tmp->flavors) & F_CRASH) || ((tmp->flavors) & F_NORMAL)) &&
((tmp->ipflags & IP_IBN) || (tmp->ipflags & IP_IFC) || (tmp->ipflags & IP_ITN))) {
/*
* If connection available, set callflag
*/
if (internet)
tmp->flavors |= F_CALL;
}
if ((tmp->flavors) & F_IMM) {
flstr[0]='I';
/*
@ -320,6 +325,7 @@ int outstat()
tmp->flavors |= F_CALL;
}
}
if ((tmp->flavors) & F_CRASH ) {
flstr[1]='C';
/*
@ -329,6 +335,7 @@ int outstat()
tmp->flavors |= F_CALL;
}
}
if ((tmp->flavors) & F_NORMAL)
flstr[2]='N';
if ((tmp->flavors) & F_HOLD )
@ -350,6 +357,7 @@ int outstat()
}
if ((tmp->flavors) & F_ISFLO )
flstr[8]='F';
if (tmp->cst.tryno >= 30) {
/*
* Node is undialable, clear callflag
@ -373,54 +381,43 @@ int outstat()
* If we must call this node, figure out how to call this node.
*/
if ((tmp->flavors) & F_CALL) {
/*
* Get options for this node
*/
tmp->callmode = CM_NONE;
if (internet && TCFG.max_tcp && !nodes.NoTCP &&
if (TCFG.max_tcp && !nodes.NoTCP &&
((tmp->ipflags & IP_IBN) || (tmp->ipflags & IP_IFC) || (tmp->ipflags & IP_ITN))) {
inet_calls++;
tmp->callmode = CM_INET;
}
if (!TCFG.ipblocks || (TCFG.ipblocks && !internet)) {
/*
* If TCP/IP blocks other trafic, (you only have one dialup line),
* then don't add normal dial trafic. If not blocking, add lines.
*/
if ((tmp->callmode == CM_NONE) && TCFG.max_isdn) {
/*
* ISDN node, check available dialout ports
* ISDN node
*/
for (tpl = pl; tpl; tpl = tpl->next) {
if (tpl->dflags & tmp->diflags) {
isdn_calls++;
tmp->callmode = CM_ISDN;
break;
}
}
}
if ((tmp->callmode == CM_NONE) && TCFG.max_pots) {
/*
* POTS node, check available modems
* POTS node
*/
for (tpl = pl; tpl; tpl = tpl->next) {
if (tpl->mflags & tmp->moflags) {
pots_calls++;
tmp->callmode = CM_POTS;
break;
}
}
}
}
}
/*
* Show callresult for this node.
*/
sprintf(temp, "%s %8s %08x %08x %08x %08x %5d %s %s %s", flstr, size_str(tmp->size),
(unsigned int)tmp->olflags, (unsigned int)tmp->moflags,
(unsigned int)tmp->diflags, (unsigned int)tmp->ipflags,
tmp->cst.tryno, callstatus(tmp->cst.trystat), callmode(tmp->callmode), ascfnode(tmp->addr, 0x0f));
tasklog('+', "%s", temp);
}
} /* All nodes scanned. */
if (nxt_hour == 24) {
/*
@ -431,16 +428,23 @@ int outstat()
}
/*
* Always set semafore do_inet if internet is needed.
* Always set/reset semafore do_inet if internet is needed.
*/
if (!s_do_inet && inet_calls) {
if (!IsSema((char *)"do_inet") && inet_calls) {
CreateSema((char *)"do_inet");
s_do_inet = TRUE;
tasklog('c', "Created semafore do_inet");
} else if (IsSema((char *)"do_inet") && !inet_calls) {
RemoveSema((char *)"do_inet");
s_do_inet = FALSE;
tasklog('c', "Removed semafore do_inet");
}
tasklog('o', "Call inet=%d, isdn=%d, pots=%d", inet_calls, isdn_calls, pots_calls);
tasklog('+', "Next event at %02d:%02d UTC", nxt_hour, nxt_min);
/*
* Log results
*/
tasklog('+', "Inet=%d, ISDN=%d, POTS=%d, Next event at %02d:%02d UTC",
inet_calls, isdn_calls, pots_calls, nxt_hour, nxt_min);
return 0;
}