mbtask now loads noderecords when scanning outbound

This commit is contained in:
Michiel Broek 2002-02-21 21:45:08 +00:00
parent 85ff404a12
commit 9cefcf9b3a
6 changed files with 65 additions and 4 deletions

View File

@ -4635,6 +4635,8 @@ v0.33.20 10-Feb-2002
mbtask:
Removed some debug logging.
Creates the semafore is_inet when the internet connections is
available, and removes it when it is down.
mbcico:
Fixed binkp driver to accept incoming unprotected sessions.

View File

@ -12,7 +12,7 @@
</HEAD>
<BODY>
<BLOCKQUOTE>
<h5>Last update 02-Feb-2002</h5>
<h5>Last update 21-Feb-2002</h5>
<P>&nbsp;<P>
<H1>Semafore files with MBSE BBS.</H1>
@ -58,6 +58,11 @@ do_inet Purpose: Signal that there are node(s) to be called via the
connection to the internet is needed.
Created and removed by mbtask.
is_inet Purpose: Signal that the internet is available. Usefull for
dialup systems to check when the internet connection is up
or down after starting or stopping ppp.
Created and removed by mbtask.
mbtask.last Purpose: A timestamp created and touched by "mbtask" every
minute so you can check it is running.
</PRE>

View File

@ -72,7 +72,7 @@ int TestNode(fidoaddr aka)
int i, nodeok = FALSE;
for (i = 0; i < 20; i++) {
if (((aka.zone == 0) || (aka.zone = nodes.Aka[i].zone)) &&
if (((aka.zone == 0) || (aka.zone == nodes.Aka[i].zone)) &&
(aka.net == nodes.Aka[i].net) &&
(aka.node == nodes.Aka[i].node) &&
(aka.point == nodes.Aka[i].point))

View File

@ -1492,12 +1492,14 @@ void scheduler(void)
tasklog('!', "Internet connection is down");
internet = FALSE;
sem_set((char *)"scanout", TRUE);
RemoveSema((char *)"is_inet");
}
} else {
if (!internet) {
tasklog('!', "Internet connection is up");
internet = TRUE;
sem_set((char *)"scanout", TRUE);
CreateSema((char *)"is_inet");
}
icmp_errs = 0;
}

View File

@ -54,6 +54,45 @@ extern int s_do_inet; /* Internet wanted */
/*
* Load noderecord if the node is in our setup.
*/
int load_node(fidoaddr);
int load_node(fidoaddr n)
{
char *temp;
FILE *fp;
int i;
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/nodes.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r")) == NULL) {
free(temp);
memset(&nodes, 0, sizeof(nodes));
return FALSE;
}
fread(&nodeshdr, sizeof(nodeshdr), 1, fp);
while (fread(&nodes, nodeshdr.recsize, 1, fp) == 1) {
fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR);
for (i = 0; i < 20; i++) {
if ((n.zone == nodes.Aka[i].zone) || (n.net == nodes.Aka[i].net) ||
(n.node == nodes.Aka[i].node) || (n.point == nodes.Aka[i].point)) {
fclose(fp);
free(temp);
return TRUE;
}
}
}
fclose(fp);
memset(&nodes, 0, sizeof(nodes));
free(temp);
return FALSE;
}
void set_next(int, int);
void set_next(int hour, int min)
{
@ -164,6 +203,10 @@ int outstat()
first = FALSE;
}
if (load_node(tmp->addr))
tasklog('o', "Loaded node %s, NoCall=%s, NoTCP=%s", ascfnode(tmp->addr, 0x0f),
nodes.NoCall?"True":"False", nodes.NoTCP?"True":"False");
/*
* Zone Mail Hours, only use Fidonet Hours.
* Other nets use your default ZMH.
@ -237,7 +280,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,"...... ... ..");
/*
* If the node has internet and we have internet available, check if we can send
@ -312,6 +355,12 @@ int outstat()
if (tmp->t2)
flstr[12] = tmp->t2;
/*
* If forbidden to call from setup, clear callflag.
*/
if (nodes.NoCall)
tmp->flavors &= ~F_CALL;
/*
* If we must call this node, figure out how to call this node.
*/
@ -322,7 +371,7 @@ int outstat()
tmp->callmode = CM_NONE;
if (internet && TCFG.max_tcp &&
if (internet && TCFG.max_tcp && !nodes.NoTCP &&
((tmp->ipflags & IP_IBN) || (tmp->ipflags & IP_IFC) || (tmp->ipflags & IP_ITN))) {
inet_calls++;
tmp->callmode = CM_INET;

View File

@ -5,6 +5,9 @@
typedef enum {CM_NONE, CM_INET, CM_ISDN, CM_POTS, MBFIDO, MBINDEX, MBFILE, MBINIT} CMODE;
struct _nodeshdr nodeshdr; /* Header record */
struct _nodes nodes; /* Nodes datarecord */
/*
* Linked list of nodes with mail in the outbound.